Ask a Question related to PHP Development, Design and Development.
-
Deutscher #1
Radio Button Variables to MySQL
Hello,
I have a simple question, I am new to PHP Programming. I want to make a
simple survey and insert the data into a MySQL Server. The data gets into
the database fine, but I do not get the VALUE of the selected radio button.
Instead what I get under the fields of the table is the NAME value. Example
like:
Table: gender_survey
Field: GENDER Data: GENDER
What I want is:
Table: gender_survey
Field: GENDER Data: MALE -OR- FEMALE depending on the radio button selected.
-----------------------form.html-----------------------
<form method="POST" action="collect.php">
Gender: Male <input type="radio" value="MALE" name="Gender"> Female<input
type="radio" value="FEMALE" name="Gender">
<input type="submit" value="Submit" name="B1"><input type="reset"
value="Reset" name="B2"
</form>
---------------------------------------------------------
-----------------------collect.php-----------------------
Danke für Ihre Meinung!
<?
$username="USERNAME";
$password="PASSWORD";
$database="test";
$Gender=array('MALE','FEMALE');
$Gender=$_POST['Gender'];
mysql_connect("10.33.39.252",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO geschlechts_umfragen VALUES ('Gender')";
mysql_query($query);
mysql_close();
?>
-----------------------------------------------------------
Danke Schön!
Deutscher Guest
-
radio button
i have 2 radio button and i want to set the 1st one is defaul <CFSET typeA = 'exempt'> <INPUT type='radio' name='typeA' value ='exempt'... -
Radio Button vSpacing
Hello! I know this has to be really simple, but I can't seem to get it right. I have a flash survey that pulls the questions and radio buttons... -
Radio Button Validation
:o Hello, I am using CFForm and CFInput to construct a rather simple form. However, the javascript that I am using in the onvalidate event of one of... -
Radio Button Help me please!
Hi I need help quick! let me explain my problem: I¹ve made a form in flash with textfields and radio buttons. It submits the data from the... -
Radio button question
Maybe a too simplistic solution, but which works fine, is to put textboxes over de buttons which contains the text you want the user to see. Make... -
Alvaro G Vicario #2
Re: Radio Button Variables to MySQL
*** Deutscher wrote/escribió (Mon, 06 Sep 2004 04:29:20 GMT):
You never use the variable. You insert a constant string:> Instead what I get under the fields of the table is the NAME value.
INSERT INTO geschlechts_umfragen VALUES ('Gender')
What's this, the remainings of a test?> $Gender=array('MALE','FEMALE');
$query = "INSERT INTO geschlechts_umfragen VALUES ('" .> $Gender=$_POST['Gender'];
> $query = "INSERT INTO geschlechts_umfragen VALUES ('Gender')";
mysql_escape_string($Gender) . "')";
--
-- Álvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--
Alvaro G Vicario Guest
-
Breaker One #3
Re: Radio Button Variables to MySQL
Deutscher wrote:
You may want to put a $ by gender in $query.. right?> Hello,
>
> I have a simple question, I am new to PHP Programming. I want to make a
> simple survey and insert the data into a MySQL Server. The data gets into
> the database fine, but I do not get the VALUE of the selected radio button.
> Instead what I get under the fields of the table is the NAME value. Example
> like:
>
> Table: gender_survey
> Field: GENDER Data: GENDER
>
> What I want is:
>
> Table: gender_survey
> Field: GENDER Data: MALE -OR- FEMALE depending on the radio button selected.
>
> -----------------------form.html-----------------------
> <form method="POST" action="collect.php">
> Gender: Male <input type="radio" value="MALE" name="Gender"> Female<input
> type="radio" value="FEMALE" name="Gender">
> <input type="submit" value="Submit" name="B1"><input type="reset"
> value="Reset" name="B2"
> </form>
> ---------------------------------------------------------
> -----------------------collect.php-----------------------
> Danke für Ihre Meinung!
>
> <?
> $username="USERNAME";
> $password="PASSWORD";
> $database="test";
>
> $Gender=array('MALE','FEMALE');
> $Gender=$_POST['Gender'];
>
> mysql_connect("10.33.39.252",$username,$password);
> @mysql_select_db($database) or die( "Unable to select database");
>
> $query = "INSERT INTO geschlechts_umfragen VALUES ('Gender')";
> mysql_query($query);
>
> mysql_close();
> ?>
> -----------------------------------------------------------
>
>
> Danke Schön!
>
>
Breaker One Guest
-
RootShell #4
Re: Radio Button Variables to MySQL
$query = "INSERT INTO geschlechts_umfragen VALUES ('$Gender')";
--
ZXSpectrum "Name The Game" - Can you guess the name of ZXSpectrum games,
just by looking at a ingame picture? Well you can find out if you can (or
not) at.... http:/ntg.docaj.net
--
RootShell Guest
-
Unregistered #5
Radio Button Variables to MySQL
Use "RadioGroup" to create and add Radio Buttons, and then retrieve the value of the selected Radio Button in the Group.
Unregistered Guest



Reply With Quote

