Solved

insert radio to mysql database using php

Posted on 2008-10-15
6
292 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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 500 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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 dynamically set the form action using jQuery.

777 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