Hi everyone,
Basically, I have an HTML form with a text field inside it. I am using JavaScript to validate the form (and check that field for completeness). Once some text is entered into the field and the submit button clicked, the user is taken to another page and using PHP I store the variable for later use.
If the user leaves the field blank and hits submit, a JavaScript alert pops up and says "You cannot leave the "User_Name" field blank." The code for the field is:
<input type="text" name="User_Name" maxlength="12"/>
The reason I named it "User_Name" instead of "User Name" is because PHP can't recognize the space in the name when I say:
$_POST['User Name'] = addslashes($_POST['User Name']);
So, is there any way to have a space in the field element's name attribute for pretty JavaScript alerts, but still make the variable available to PHP?
Is the easiest way simply to strip the spaces from the names before using them with PHP?
THanks a bunch!!!