Frage

Setup:

We've got a form with default text values present within the text box itself which "goes away" when I click on them and enter a value (not if I dont enter a value). Currently the 'default' value or the user inputted value gets POSTed to the PHP script.

Should I have the javascript code check if the value being submitted is the default one and set it to "" (blank string) OR should I perform this check in PHP where I'll have to do a check if its "" OR if its to the default value.

Which is more efficient, having javascript clean up the data before sending it to PHP, or having PHP do the check itself?

One reason to keep it within PHP (though not a consideration for us at the moment) is so that we can display the default text labels in multiple languages, and check if the user has left them blank. That would be easier in PHP, I imagine?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
scroll top