hi,
how could i set a variable with a submit button in order to differenciate 2 behaviours, so first time the same submit button will insert in database and in second time it updates database values.
Thanks.
hi,
how could i set a variable with a submit button in order to differenciate 2 behaviours, so first time the same submit button will insert in database and in second time it updates database values.
Thanks.
Depends on your implementation, and if it's ajax..
If ajax, you want to make a note of the fact it's an update somewhere.. perhaps a form element that says so?
<input type="hidden" id="formUpdate" value="0" />
and on the first submit
document.getElementById('formUpdate').value = 1; // and on the submit, check if it's 0 or 1
If posting to the server, you can include the in the code so when the form is submitted again, you can access $_REQUEST['formUpdate'] (such as with php, anyway) ..
hope that helps ya