If you're familiar with getting data out of a table, then I don't believe
you really need any examples.

Consider the following over view or what you might do with a CD store:

Get a product row from a data base into an array.  it might look something
like:

$myrow["id"] (55)
$myrow["artist"] (Nine Inch Nails)
$myrow["title"] (The downward Spiral)
$myrow["price"] (25.99)
$myrow["category"] (Alternative)
$myrow["additional_info"] (Limted edition cover art)

Apart from the category, these are all text fields, so build your form, and
echo these values into the form value="".  eg:

<INPUT type="text" value="<?=$myrow["artist"]?>" size="50" maxlength="255">
etc etc

In the case of category, you might have 5 categories in a pull down.  the
aim would be to list all categories, and flag the current category as
SELECTED.  This can be done with an if statement:

<SELECT name="category">
    <OPTION value="rock" <? if($myrow["category"] == "rock") { echo
"SELECTED"; } ?>>rock</OPTION>
    <OPTION value="jazz" <? if($myrow["category"] == "jazz") { echo
"SELECTED"; } ?>>jazz</OPTION>
    <OPTION value="alternative" <? if($myrow["category"] == "alternative") {
echo "SELECTED"; } ?>>alternative</OPTION>
    <OPTION value="blues" <? if($myrow["category"] == "blues") { echo
"SELECTED"; } ?>>blues</OPTION>
</SELECT>

This would echo SELECTED in the "alternative" OPTION only.


Check boxes, groups of radio buttons, etc etc can all be done in simular
ways.


Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------





on 30/04/02 9:29 PM, Denis L. Menezes ([EMAIL PROTECTED]) wrote:

> Hello friends,
> 
> Can someone please tell me where I can find sample scripts for populating
> textboxes and listboxes on a form(when the form opens) using the data from
> fields in a table?
> 
> Thanks
> Denis
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to