Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

insert radio to mysql database using php

Posted on 2008-10-15
6
Medium Priority
?
301 Views
Last Modified: 2013-12-13
Hi
if i have this example that ara sent me:
<input type="radio" name="first" value="Red"> Red<br>
<input type="radio" name="first" value="White"> White<br>
<input type="radio" name="first" value="Blue"> Blue<br>
 
<input type="radio" name="second" value="Grey"> Grey<br>
<input type="radio" name="second" value="Yellow"> Yellow<br>
<input type="radio" name="second" value="Dark"> Dark<br>

and if i want to insert to my table the choices that client did
ex: he have chosen :red and yellow and i have in my table field called choice
can i do this
insert the value to my field (how i can insert theses choices into my database
0
Comment
Question by:asaidi
  • 4
  • 2
6 Comments
 
LVL 4

Expert Comment

by:Ara-
ID: 22719765
Which columns / fields to the table have?
0
 

Author Comment

by:asaidi
ID: 22719791
i have a table called description

there is id ,description choice1,choice2,choice3
then client if he has chosen (ex:the fisrt choice is white then it will be added to choice1,then he choosed grey it will be added to choice 2 and so...
0
 
LVL 4

Expert Comment

by:Ara-
ID: 22719817
You can extract the results in php with:
$_REQUEST["name"];

Where name is first and second.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:Ara-
ID: 22719833
The SQL statement would be something like:
INSERT INTO description VALUES(id, description, choice1, choice2);
id can be exchanged with NULL if it is an auto_increment.
Remember to enclose strings with quotes.
0
 

Author Comment

by:asaidi
ID: 22719853
can you check my web page i did :

http://83.71.142.153/feedback/feedback.php and you will see the choices i have
0
 
LVL 4

Accepted Solution

by:
Ara- earned 2000 total points
ID: 22719891
I tried filling in the fields and submit. I get a page not found.
<FORM METHOD="POST" ACTION="--WEBBOT-SELF--">
The action should contain the webpage that will process the input. E.g. a new php-page (ACTION="results.php").

The results.php file should then get the variables which seems to be:
$_REQUEST["T2"] for Client
$_REQUEST["T1"] for Date
$_REQUEST["T3"] for Project
$_REQUEST["T4"] for Job No
$_REQUEST["R1"] for Choice 1 (Communication)
$_REQUEST["R2"] for Choice 2 (Availability)
and so forth..

You then need to make the php script connect to the database and insert these values.

Check out this page if you need to:
http://www.php-mysql-tutorial.com/
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question