[Help]some values are not posted

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
iijb
Forum Commoner
Posts: 43
Joined: Wed Nov 26, 2008 11:34 pm

[Help]some values are not posted

Post 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
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: [Help]some values are not posted

Post by klevis miho »

Paste some code
User avatar
iijb
Forum Commoner
Posts: 43
Joined: Wed Nov 26, 2008 11:34 pm

Re: [Help]some values are not posted

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: [Help]some values are not posted

Post by AbraCadaver »

Need the actual form code.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: [Help]some values are not posted

Post 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).
Post Reply