Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199903

RE: [PHP3] How do I?? From: Nathan Reeves (BBRAY30 <email protected>)
Date: 03/03/99

Thanks to everyone for the answer. It's always simple when its
explained.

Regards

Nathan

 -----Original Message-----
From: huntsman [SMTP:huntsman <email protected>]
Sent: Wednesday, 3 March 1999 11:20
To: BBRAY30
Cc: php3
Subject: Re: [PHP3] How do I??

On 2 Mar, Nathan Reeves wrote:
>
> Apologies if this seems simple but I've been trying to work this one
out
> for
> a while now. I've got a DB that stores info about PC's. There is one
    

> main
> table that holds 'core' information and a seperate table that holds
> additional data. The relationship between the two is a equipment
number
> that is auto generated. So to get info back on equipment 'X' I would
    

> select
> the recordset in the main table and use the equipment number contained
in
> that recordset to select any additional information that may be stored
    

> for
> that PC in the other table.
>
> I want to create a page with a drop down box of all the PC Names. When
    

> the
> user has selected the PC they want they then move to another page that
> displays the data for that equipment. Assuming I've selected all PC
> names
> to produce the drop down selection box, how do I work out the equipment
> number from this list without having to go back to the DB. Is there a
    

> way
> of tying the drop down box with a variable that I can pass to the next
    

> page
> in order to query the second table by equipment number.
>
> This may seem confused, but it's harder to describe than visualise in
my
> mind.
>
> Any help on this problem would be greatly appreciated.
>
>
> Regards
>
> Nathan Reeves
> Perth, Western Australia
>

Quick answer - build your dropdown list using the equipment number as
the VALUE for the OPTION tag in your list. That will pass the equipment
number to your next form. In p-code you'd do something like

query = "SELECT pcname, pcid from pcdata"
run-query(db, query)
<FORM ACTION=nextform.php3 ACTION="POST">
<SELECT NAME="whatever">
for each row do
<OPTION VALUE="echo pcid">echo pcname
endfor
</SELECT></FORM>

You should be able to turn that into something that works :-)

Cheers
 --
David Robley

WEBMASTER | Phone +61 8 8374 0970
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA
            Visit the PHP mirror at http://au.php.net:81/

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>