Solved

insert radio to mysql database using php

Posted on 2008-10-15
6
290 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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…
The viewer will learn how to count occurrences of each item in an array.

744 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

12 Experts available now in Live!

Get 1:1 Help Now