Jump to content

[SOLVED] $_POST['list_name'] value pass error


elabuwa

Recommended Posts

Hey guys,

 

I have a list box named "tax_code" which is populated dynamically when page is loaded.

the code for populating is below.

 

<select name="tax_code" id="tax_code">

    <option value="NA">NA</option>

    <?php

 

$tbl_name="tax_table"; // Table name

 

$query="SELECT code FROM $tbl_name ORDER BY code";

$result=mysql_query($query);

$num=mysql_num_rows($result);

If ($num != 0){

while($row = mysql_fetch_array($result)){

  $idz = $row['code'];

  echo "<option value='".$row."'>".$idz."</option>";

}

}

 

//echo "<option value='V0'>VAT 123 </option>";

?>

 

that works fine.

 

the problem is when I try to get the list's selected value by $_POST['tax_code'] it returns the string "Array".

the selected item name does not appear.

But when I do the same method for another list the value appears as expected.

 

I tried rewriting the code, copyin and pastin from the workin one with no luck.

 

can you please point me in the right direction?

 

the code for getting the value is

 

$taxcode = $_POST['tax_code'];

echo $taxcode;

exit;

 

which returns "Array"

 

thanks a lot in advance

Link to comment
https://forums.phpfreaks.com/topic/176523-solved-_postlist_name-value-pass-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.