I\’m practicing form validation with JavaScript but when I try to retrieve the data from the page it submits to I can\’t get it.
form.html
<body>
Hello.<br />
<form onsubmit=\"return validate()\" action=\"process.php\" method=\"POST\">
Enter name: <input type=\"text\" id=\"name\" /><br />
Enter phone number: <input type=\"text\" id=\"number\" /><br />
Enter password: <input type=\"password\" id=\"paswd\" /><br />
Is there anything else you would like to add: <input type=\"text\" id=\"anything\" /><br />
<input type=\"submit\" value=\"Check Form\" />
</form>
</body>
process.php
<?php
echo \'Here: \'.$_POST[\'number\']
?>
Whatever index I use I get \” Undefined index: line 2\”. What am I doing wrong?
EDIT: So I can\’t use the id attribute I need the name? Is there anyway to prevent coding redundancy since the value of all names will be the same as the corresponding id?





Rating:
The post php – form data not getting passed appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/php-form-data-not-getting-passed.html
No comments:
Post a Comment