Page 1 of 1

[Help]some values are not posted

Posted: Fri May 21, 2010 1:24 am
by iijb
Hi
I have a registration form(registration.php) in which there are text boxes, dropdown lists and radio buttons. My problem is when I post the form data for insertion in MySql some posted values are missing in the action page(insert.php). I print the values using print_r($_POST) and some values from the dropdown lists and radio buttons are missing. How to solve this ?
Plz help

iijb

Re: [Help]some values are not posted

Posted: Fri May 21, 2010 4:18 am
by klevis miho
Paste some code

Re: [Help]some values are not posted

Posted: Mon May 24, 2010 1:54 am
by iijb
Hi
Here is my code. Altogether there are plenty of dropdown lists and radiobuttons in my register.html page. Here is the code for insert.php to which register.html posts data.

Code: Select all

<?php
include "dbcon.php";
$userid=randNum();
if(isset($_POST['btnSubmit']))
{
	
	$gender=$_POST['rdbGender'];  //from a radiobutton in register.html
	$age=$_POST['txtAge'];            //from a textbox in register.html
	$height=$_POST['lstHeight'];    //from a dropdown list in register.html
	$weight=$_POST['lstWeight'];
	$bodytype=$_POST['lstBodytype'];
	$complexion=$_POST['lstComplexion'];
	$bloodgroup=$_POST['lstBloodgroup'];
	$physical=$_POST['rdbPhysical'];
	$maritalstat=$_POST['rdbMaritalstatus'];
	$mothertong=$_POST['lstMothertongue'];
	$religion=$_POST['lstReligion'];
	$citizenship=$_POST['lstCitizenship'];
	$country=$_POST['lstCountry'];
	$state=$_POST['lstResidingstate'];
	$city=$_POST['lstCity'];
	$residingstatus=$_POST['rdbResidingstatus'];
	$educationcat=$_POST['lstEducationcat'];
	$educationdet=$_POST['txtEducationdet'];
	$employedin=$_POST['rdbEmployedin'];
	$occupation=$_POST['lstOccupation'];
	$occupationdet=$_POST['txtOccupationdet'];
	$annualincome=$_POST['txtAnnualincome'];
	$fatheroccupation=$_POST['lstFatheroccupation'];
	$motheroccupation=$_POST['lstMotheroccupation'];
	$nobrothers=$_POST['lstNumberbrothers'];
	$nosisters=$_POST['lstNumbersisters'];
	$eatinghabit=$_POST['lstEatinghabit'];
	$smokinghabit=$_POST['lstSmokinghabit'];
	$drinkinghabit=$_POST['lstDrinkinghabit'];
	$aboutme=$_POST['txtAboutme'];
	
	print_r($_POST);   // This print is not displaying all the values

//Here only first three values inserted in the db

$query="INSERT INTO t_member_profile VALUES('$userid','$gender','$age','$height','$weight',																							'$bodytype','$complexion','$bloodgroup','$physical','$maritalstat','$mothertong',																																											'$religion','$citizenship','$country','$state','$city','$residingstatus','$educationcat','$educationdet','$employedin','$occupation','$occupationdet','$annualincome','$fatheroccupation','$motheroccupation','$nobrothers','$nosisters','$eatinghabit','$smokinghabit','$drinkinghabit','$aboutme')";
$result=mysql_query($query) or die('Error'.mysql_error());
echo "1 row added";
}
else
echo "sorry";
?>
Thanks
iijb

Re: [Help]some values are not posted

Posted: Mon May 24, 2010 10:08 am
by AbraCadaver
Need the actual form code.

Re: [Help]some values are not posted

Posted: Mon May 24, 2010 10:43 am
by John Cartwright
..and for the love PHP pass all your user input through mysql_real_escape_string() when querying that data. Otherwise, it is possible your query will fail (or be hijacked).