Solved

insert radio to mysql database using php

Posted on 2008-10-15
6
291 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now