rsammy Posted November 7, 2006 Share Posted November 7, 2006 Can someone help me please???????i am trying to hide a field on screen. But, I need to default it to a value that I will be using to populate the database. I tried some ways but am not successful here.This is the original code:<tr><td width="275"><div align="right"><font class="inputLbl">Registered Client: </font> </div></td><td colspan="2"><? $queryclient="SELECT client_name, client_id FROM clients";$resultclient= mysql_query($queryclient);if ($resultclient)//if (mysql_num_rows($resultclient) != 0){ //print ("<select name='client_id'>"); print ("<select name='ClientName'>"); if ($row = mysql_fetch_array($resultclient)) { do { print("<option value=\""); echo $row["client_name"]; if ($row["client_name"]== $client_name) { print("\" selected>"); } else { print("\">"); } print $row["client_name"]; print("</option>"); //} } while($row = mysql_fetch_array($resultclient)); } } print ("</select>");?></td></tr>This code displays the value as a drop down box. it has 3 values in the database table and it displays them. I dont want this now. What I now need is to default this field to one particular value from the drop down. i will need to pass this value to a variable or something so I can save it in the db table.I am trying to do somethign like this ...<tr> <td width="283"> <div align="right"><font class="inputLbl"> <input type="hidden" name="Client_Name" value="<? print ("$xxxxxxxx"); ?>"> </font></div></td> <td colspan="2"> </td></tr>$xxxxxxxx could be the default value, say 'Group'. I need it to point to Group to be able to insert it into the db table.Please help me guys... Link to comment https://forums.phpfreaks.com/topic/26392-help-with-hiding-a-field-on-screen/ Share on other sites More sharing options...
bqallover Posted November 7, 2006 Share Posted November 7, 2006 What you're doing looks good. Just access the value with $_GET['Client_Name'] as you would normally. Link to comment https://forums.phpfreaks.com/topic/26392-help-with-hiding-a-field-on-screen/#findComment-120705 Share on other sites More sharing options...
rsammy Posted November 7, 2006 Author Share Posted November 7, 2006 that was a great help! thanx, bqallover! ;D Link to comment https://forums.phpfreaks.com/topic/26392-help-with-hiding-a-field-on-screen/#findComment-121253 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.