The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML Forms, Reading of input and checking and unchecking of radio buttons not work
tudsy
post 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
Attached File  Unsubscribe.html ( 1.49k ) Number of downloads: 1679
Attached File  unsubscribe.php ( 1.96k ) Number of downloads: 1593
Attached File  Sorrytoseeyougo.html ( 1.13k ) Number of downloads: 1680
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 30 2014, 08:14 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



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. 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).



User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 02:45 AM