By: My
Date: 2006-06-23
Time: 10:02
|
HELP in using SELECTED
I'm new with php and html.Hope you can help me.
I have this HTML form with combo box (using OPTION value) and
the records came from a table.
I want to view initially in that combo box the value from the previous page.
It's somewhat like, i want to edit records and one of the field will be in a combo box.
Hope you can help me with this.
thanks a lot.
|
By: Skrol29
Date: 2006-06-23
Time: 11:59
|
Re: HELP in using SELECTED
Hello, here is how to do it with TBS:
With TBS 3, and plug-in HTML:
<select ...>
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option>[var.UserValue;ope=html;select]</option>
</select>
|
With TBS 2.x (no plug-in required):
<select ...>
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option>[var.UserValue;selected]</option>
</select>
|
To feed a list with data coming from database:
<select ...>
<option value="[item.value;block=option]">[item.caption]</option>
<option>[var.UserValue;ope=html;select]</option>
</select>
|
|
By: My
Date: 2006-06-26
Time: 07:33
|
Re: HELP in using SELECTED
Can't still not load the previous value in the combo box.
Here is my code in PHP
$sql = "SELECT device_geninfo.geninfo_ref, device_geninfo.diename, producttype.prodtype_code, device_geninfo.datequal, processcode.process_code, device_geninfo.process
FROM (device_geninfo INNER JOIN producttype ON device_geninfo.prodtype_ref = producttype.prodtype_ref)
INNER JOIN processcode ON device_geninfo.process = processcode.processcode_ref
WHERE device_geninfo.geninfo_ref='$refid'";
$sqlQuery=mysql_query( $sql ) or die (mysql_error());
$result=mysql_query($sql,$conn);
if (($result) && (mysql_num_rows($result) > 0))
{
while ($row=mysql_fetch_array($sqlQuery))
{
$arrGeninfo_ref[]=array("geninfo_ref" => $row[0]);
$arrDiename[]=array("diename" => $row[1]);
$arrProcess_ref[]=array("process" => $row[5]);
$row++;
}
//Process Code from table
$sql = "SELECT process_code, process_desc, processcode_ref FROM processcode ORDER BY process_code";
$sqlQuery=mysql_query( $sql ) or die (mysql_error());
$result=mysql_query($sql,$conn);
if (($result) && (mysql_num_rows($result) > 0))
{
while ($row=mysql_fetch_array($sqlQuery))
{
$process_code[]=array(
'proccode'=>$row[0],
'procdesc'=>$row[1],
'procref'=>$row[2]);
$row++;
}
}
$tbs = new clsTinyButStrong;
$tbs->LoadTemplate('templates/devices_edit.html');
$tbs->MergeBlock('geninfo_ref',$arrGeninfo_ref);
$tbs->MergeBlock('diename',$arrDiename);
$tbs->MergeBlock('process',$process_code);
$tbs->Show();
}
|
Here's my code in HTML to call the process:
<tr>
<td align=right class=large><font size=2>Process: </td>
<td><font size=2>
<select maxlength="30" name="process_ref">
<option value="[process.procref]">
[process.proccode;block=option;noerr]
</option>
<option>[var.procselect;ope=html;select]</option>
</select>
</td>
</tr>
|
thanks a lot.
|
By: Skrol29
Date: 2006-06-26
Time: 16:18
|
Re: HELP in using SELECTED
Hello,
You have to give more information to make a diagnosis.
Can you check what value has the variable $procselect before you call TBS->Show() ?
You have to make this variable to contain the value from the previous page.
|
|
Posting in progress.
Please wait...
|