I have been trying to post a value from a radiobutton selection into my database. My datatype in mysql is int. I want value to be 1 or 0. But I believe it takes the value from the radio input type as a string. I need help in posting a value from a radiobutton into my database.
mundetas
0
Light Poster
Recommended Answers
Jump to PostPost your code.
Jump to Post:) I used your code to insert radio button value to column age with datatype int.
<html> <body> <form method='post'> <input type="radio" value="1" name="ys"> <input type='submit' name='submit' value='submit'> </form> </body> </html> <?php if(isset($_POST['submit'])) { $con = mysql_connect("localhost","root"); mysql_select_db("test2"); $radiobutton=$_POST['ys']; mysql_query("insert into a (age) values ('{$radiobutton}')"); } ?>
If this …
All 8 Replies
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
mundetas
0
Light Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
mundetas
0
Light Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
mundetas
0
Light Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
wrivera
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.