Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ HTML Forms

Posted by: tudsy Sep 30 2014, 06:12 AM

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
Attached File  Unsubscribe.html ( 1.49k ) Number of downloads: 1167
Attached File  unsubscribe.php ( 1.96k ) Number of downloads: 1155
Attached File  Sorrytoseeyougo.html ( 1.13k ) Number of downloads: 1203

Posted by: Christian J Sep 30 2014, 08:14 AM

QUOTE(tudsy @ Sep 30 2014, 01:12 PM) *

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. http://php.net/manual/en/mysqli.real-escape-string.php before querying your database, or you will end up with an SQL injection (perhaps someone stealing or deleting your whole email address table).




Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)