View Full Version : List Menu

10-05-2005, 03:27 AM
Hi, I am Les... a newbie

need help on passing the value to listbox...
from master page(search, columnar style) i have a certain data... and once i click the link it opens my update page(entry style).. displayed the data i choose... textfield are fine... but in listmenu, it always shows the default value, instead of the data from masterpage...

hope you got what i mean... tnx in advance and God bless you all...

10-05-2005, 08:49 AM
what script language are you using

10-06-2005, 01:03 AM
what script language are you using
i am using PHP...

here the code i did... i added the red... but it doubled the list... i.e. the return value 2, so it displays ... but when i click the list selection... it show 2... 1... 2... 3..., instead of 1... 2... 3... only

<td bgcolor="#FFFFCC"><select name="cbo_accttype" id="cbo_accttype" title="<?php echo $row_rsUpdate['AcctType']; ?>">
<option selected><span style='color:red'><?php echo $row_rsUpdate['AcctType']; ?></span></option>

thanks again and God bless you.

10-06-2005, 09:13 AM
i assume you are passing a record ID through $_POST to your querystring on the update page

to set a dropdown to a specific value you need to use strcmp() function


<select name="company" >

<option value="v1"<?php if (!(strcmp($variable, 'v1'))){echo "SELECTED";} ?>

<option value="v2"<?php if (!(strcmp($variable, 'v2'))){echo "SELECTED";} ?>

<option value="v2"<?php if (!(strcmp($variable, 'v3'))){echo "SELECTED";} ?>


using strcmp you are looking for an exact comparison between the two arguments $variable, 'v1' then if boolean true echo SELECTED

you can pass the variable from your first page and setting it in this page
$variable = $_POST['txtfieldName'];

or if you are querying a db from this page you could just set $variable with the contents of $row_recordsetname['mysql_field'];

$variable = $row_recordsetname['mysql_field'];

If you tell me exactly how you are passing the data from page 1 > page 2 i will be able to help more

10-08-2005, 01:39 AM
Thanks davidj... i'll try this...
till next time... ingat (means take care), enjoy and God bless you.