HTML Forms, Reading of input and checking and unchecking of radio buttons not work |
HTML Forms, Reading of input and checking and unchecking of radio buttons not work |
tudsy |
Sep 30 2014, 06:12 AM
Post
#1
|
Advanced Member Group: Members Posts: 246 Joined: 30-September 14 Member No.: 21,611 |
Hi
I have two problems: 1. I set one of the input controls to checked (radio button) but when it appears in the browser the action is of the following: When I select the other other option, both options are checked. Can anyone help? 2.I cannot read the variables e_address and value by the PHP script when i press the submit button. Thanks. Adrian Unsubscribe.html ( 1.49k ) Number of downloads: 1692 unsubscribe.php ( 1.96k ) Number of downloads: 1607 Sorrytoseeyougo.html ( 1.13k ) Number of downloads: 1693 |
Christian J |
Sep 30 2014, 08:14 AM
Post
#2
|
. Group: WDG Moderators Posts: 9,665 Joined: 10-August 06 Member No.: 7 |
1. I set one of the input controls to checked (radio button) but when it appears in the browser the action is of the following: When I select the other other option, both options are checked. Both radio buttons need the same NAME attribute value (currently they share the same ID value, which is not allowed in HTML). The NAME value must match that used in the PHP script: CODE $_POST['value'] (which currently uses the confusing value "value"). QUOTE 2.I cannot read the variables e_address and value by the PHP script when i press the submit button. This is because the form fields lack NAME attributes. See also http://php.net/manual/en/tutorial.forms.php Also you must sanitize user data with e.g. mysqli_real_escape_string before querying your database, or you will end up with an SQL injection (perhaps someone stealing or deleting your whole email address table). |
Lo-Fi Version | Time is now: 13th May 2024 - 02:25 AM |