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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.