hello can anyone help me how to insert GET variable into mysql 
<?php
$page_title = 'Personal Wellness';
include ('template/header.inc');
include_once('config.php');
$id = $_GET['id'];
if(isset($_POST['submit']))
//if submit was pressed
{
if(strlen($_POST['height'])<1) //if there was no height
{
print "You did not enter a height.";
}
else if(strlen($_POST['weight'])<1) //no weight
{
print "You did not enter a weight.";
}
else if(strlen($_POST['bodyfat'])<1) //no bodyfat
{
print "You did not enter a Body Fat Range";
}
else if (strlen ($_POST['bodywater'])<1) //no bodywater
{
print "You did not enter a Body Water Range";
}
else if( strlen($_POST['musclemass'])<1) //no musclemass
{
print "You did not enter a Muscle Mass";
}
else if (strlen ($_POST['physiqueratt'])<1) //no physiqueratt
{
print "You did not enter a Physique Ratings";
}
else if (strlen ($_POST['bonemass'])<1) //no bonemass
{
print "You did not enter a Bone Mass";
}
else if (strlen ($_POST['bmr'])<1) //no bmr
{
print "You did not enter a BMR";
}
else if (strlen ($_POST['basalmetabolic'])<1) //no basalmetabolic
{
print "You did not enter a Basal Metabolic Age";
}
else if (strlen ($_POST['visceralfat'])<1) //no visceralfat
{
print "You did not enter a Visceral Fat";
}
else if(strlen($_POST['registrationmonth'] && $_POST['registrationday'] && $_POST['registrationyear'])<1) // no date
{
print "You did not enter a date of birth";
}
else //all fields met
{
$id=$_GET['id'];
$height=$_POST['height'];
$weight=$_POST['weight'];
$bodyfat=$_POST['bodyfat'];
$bodywater=$_POST['bodywater'];
$musclemass=$_POST['musclemass'];
$physiqueratt=$_POST['physiqueratt'];
$bonemass=$_POST['bonemass'];
$bmr=$_POST['bmr'];
$basalmetabolic=$_POST['basalmetabolic'];
$visceralfat=$_POST['visceralfat'];
$date=$_POST['registrationyear'] . '-' . $_POST['registrationmonth'] . '-' . $_POST['registrationday'];
$insertadmin="INSERT into personalwelness (m_id,height,weight,body_fat,body_water,muscle_mas s,physique_ratt,bone_mass,bmr,basal_metabolic,visc eral_fat,evaluation_date) values ('$id','$height','$weight','$bodyfat','$bodywater','$mus clemass','$physiqueratt','$bonemass','$bmr','$basa lmetabolic','$visceralfat','$date')"; //registering admin in databae
echo $insertadmin;
$insertadmin2=mysql_query($insertadmin) or die("Could not insert admin");
print "Personal Wellness Successfully Submitted";
}
}
?>
Enter Personal Wellness Information in the form below:
Height(CM) |
: |
|
Weight(KG) |
: |
|
Body Fat Range |
: |
|
Body Water Range(%) |
: |
|
Muscle Mass |
: |
|
Physique Ratings |
: |
|
Bone Mass |
: |
|
BMR |
: |
|
Basal Metabolic Age |
: |
|
Visceral Fat |
: |
|
Evaluation Date |
: |
<?php echo date_picker("registration")?> |
<?php
function date_picker($name, $startyear=NULL, $endyear=NULL)
{
if($startyear==NULL) $startyear = date("Y")-100;
if($endyear==NULL) $endyear=date("Y")+50;
$months=array(’’,‘January’,‘February’,‘March’,‘Apr il’,‘May’,
‘June’,‘July’,‘August’, ‘September’,‘October’,‘November’,‘December’);
// Month dropdown
$html="<select name="".$name.“month”>";
for($i=1;$i<=12;$i++)
{
$html.="$months[$i]";
}
$html.=" ";
// Day dropdown
$html.="<select name="".$name.“day”>";
for($i=1;$i<=31;$i++)
{
$html.="<option $selected value=’$i’>$i";
}
$html.=" ";
// Year dropdown
$html.="<select name="".$name.“year”>";
for($i=$startyear;$i<=$endyear;$i++)
{
$html.="$i";
}
$html.=" ";
return $html;
}
?>
<?php
include ('template/footer.inc');
?>