Hello all,
I have the following problem, I have a pulldown in my form with all the countrycodes. I populate the pulldown from my mysql table and present it to the customer. So far so good.
But If the customer changes the country code via the pulldown it doesn't change and the variable will be empty in my table.
Here is the code..
The call to populate the pulldown
$land = dropmenu_landen($landcode);
The function code...
function dropmenu_landen($landcode)
{
$q = mysql_query("SELECT * from landen order by omschrijving") or die("data niet opgehaald");
$Ret = '';
$Ret .= "<select name=\"code\">";
while($a = mysql_fetch_array($q))
{
$Ret .= "<option value=\"".$a['code']."\"".($post['code'] == $a['code']?" SELECTED":"").">".$a['code'].' '.$a['omschrijving']."</option>";
}
$Ret .= "</select>";
return $Ret;
}
Here you see how I use it in the form
$form_page = <<< NAWFORMPAGE
<HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " <HEAD>
<style type="text/css">
h1 {color: Blue;}
h1 {font-size: 16pt;}
BODY, P {color: black; font-family: monospace; font-size: 9 pt}
table {margin-left: 10px}
table {margin-right: 10px;}
table {width: 70%;}
table,table *{border: 1pt solid black;}
TD {background-color: #99CCFF; }
TH {background-color: #99CCCC; }
THEAD {background-color: #99CCC; }
TFOOT {background-color: #99CCC; font-family: monospace; font-size: 9 pt}
</STYLE>
</HEAD>
<TBODY>
<TABLE>
<THEAD><TR><TD>Wijzig hier uw gegevens </TD></TR></THEAD>
Support</TD></TR></TFOOT>
<TR><TD>
<FORM METHOD=POST ACTION = "$thispage">
<H1> NAW gegevens</H1>
voorl       :
<INPUT TYPE="text" NAME="voorl" SIZE=10 VALUE="$voorl"><br>
voorv       :
<INPUT TYPE="text" NAME="voorv" SIZE=10 VALUE="$voorv"><br>
Achternaam  :
<INPUT TYPE="text" NAME="achternaam" SIZE=40 VALUE="$achternaam"><br>
Straat      :
<INPUT TYPE="text" NAME="straat" SIZE=40 VALUE="$straat"><br>
Huisnr      :
<INPUT TYPE="text" NAME="huisnr" SIZE=5 VALUE="$huisnr">
       Toev :
<INPUT TYPE="text" NAME="toev" SIZE=10 VALUE="$toev"><br>
Postcode    :
<INPUT TYPE="text" NAME="postcode" SIZE=10 VALUE="$postcode">
Plaats  :
<INPUT TYPE="text" NAME="plaats" SIZE=30 VALUE="$plaats">
Land   : $land <br>
Telnr       :
<INPUT TYPE="text" NAME="telnr" SIZE=15 VALUE="$telnr"><br>
Mobielnr    :
<INPUT TYPE="text" NAME="mobielnr" SIZE=15 VALUE="$mobielnr"><br>
Email       :
<INPUT TYPE="text" NAME="email" SIZE=50 VALUE="$email"><br><br>
</TD></TR>
<TR><TD>
<input type="hidden" name="stage" value="set">
<BR><BR>
<INPUT TYPE="submit" NAME="opslaan" VALUE="Opslaan">
</FORM>
</TD></TR>
</TBODY>
</HTML>
NAWFORMPAGE;
And last how I update my table...
{
$landcode = $POST['code'];
$query = "update naw set voorl = '$voorl',
voorv = '$voorv',
achternaam = '$achternaam',
extraregel = '$extraregel',
extraregel2 = '$extraregel2',
straat = '$straat',
huisnr = '$huisnr',
toev = '$toev',
postcode = '$postcode',
land = '$landcode',
plaats = '$plaats',
telnr = '$telnr',
mobielnr = '$mobielnr',
email = '$email' where idnr = '$leasid'";
$result = mysql_query($query);
I must be doing something stupid but I cant figure out why
$posr['code'] doesnt has the value from the pulldown
Hope someone can help me
Thanks
I have the following problem, I have a pulldown in my form with all the countrycodes. I populate the pulldown from my mysql table and present it to the customer. So far so good.
But If the customer changes the country code via the pulldown it doesn't change and the variable will be empty in my table.
Here is the code..
The call to populate the pulldown
$land = dropmenu_landen($landcode);
The function code...
function dropmenu_landen($landcode)
{
$q = mysql_query("SELECT * from landen order by omschrijving") or die("data niet opgehaald");
$Ret = '';
$Ret .= "<select name=\"code\">";
while($a = mysql_fetch_array($q))
{
$Ret .= "<option value=\"".$a['code']."\"".($post['code'] == $a['code']?" SELECTED":"").">".$a['code'].' '.$a['omschrijving']."</option>";
}
$Ret .= "</select>";
return $Ret;
}
Here you see how I use it in the form
$form_page = <<< NAWFORMPAGE
<HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " <HEAD>
<style type="text/css">
h1 {color: Blue;}
h1 {font-size: 16pt;}
BODY, P {color: black; font-family: monospace; font-size: 9 pt}
table {margin-left: 10px}
table {margin-right: 10px;}
table {width: 70%;}
table,table *{border: 1pt solid black;}
TD {background-color: #99CCFF; }
TH {background-color: #99CCCC; }
THEAD {background-color: #99CCC; }
TFOOT {background-color: #99CCC; font-family: monospace; font-size: 9 pt}
</STYLE>
</HEAD>
<TBODY>
<TABLE>
<THEAD><TR><TD>Wijzig hier uw gegevens </TD></TR></THEAD>
Support</TD></TR></TFOOT>
<TR><TD>
<FORM METHOD=POST ACTION = "$thispage">
<H1> NAW gegevens</H1>
voorl       :
<INPUT TYPE="text" NAME="voorl" SIZE=10 VALUE="$voorl"><br>
voorv       :
<INPUT TYPE="text" NAME="voorv" SIZE=10 VALUE="$voorv"><br>
Achternaam  :
<INPUT TYPE="text" NAME="achternaam" SIZE=40 VALUE="$achternaam"><br>
Straat      :
<INPUT TYPE="text" NAME="straat" SIZE=40 VALUE="$straat"><br>
Huisnr      :
<INPUT TYPE="text" NAME="huisnr" SIZE=5 VALUE="$huisnr">
       Toev :
<INPUT TYPE="text" NAME="toev" SIZE=10 VALUE="$toev"><br>
Postcode    :
<INPUT TYPE="text" NAME="postcode" SIZE=10 VALUE="$postcode">
Plaats  :
<INPUT TYPE="text" NAME="plaats" SIZE=30 VALUE="$plaats">
Land   : $land <br>
Telnr       :
<INPUT TYPE="text" NAME="telnr" SIZE=15 VALUE="$telnr"><br>
Mobielnr    :
<INPUT TYPE="text" NAME="mobielnr" SIZE=15 VALUE="$mobielnr"><br>
Email       :
<INPUT TYPE="text" NAME="email" SIZE=50 VALUE="$email"><br><br>
</TD></TR>
<TR><TD>
<input type="hidden" name="stage" value="set">
<BR><BR>
<INPUT TYPE="submit" NAME="opslaan" VALUE="Opslaan">
</FORM>
</TD></TR>
</TBODY>
</HTML>
NAWFORMPAGE;
And last how I update my table...
{
$landcode = $POST['code'];
$query = "update naw set voorl = '$voorl',
voorv = '$voorv',
achternaam = '$achternaam',
extraregel = '$extraregel',
extraregel2 = '$extraregel2',
straat = '$straat',
huisnr = '$huisnr',
toev = '$toev',
postcode = '$postcode',
land = '$landcode',
plaats = '$plaats',
telnr = '$telnr',
mobielnr = '$mobielnr',
email = '$email' where idnr = '$leasid'";
$result = mysql_query($query);
I must be doing something stupid but I cant figure out why
$posr['code'] doesnt has the value from the pulldown
Hope someone can help me
Thanks