RE: [PHP-DB] calling a column into a popup

From: Date: Mon, 23 Apr 2001 15:02:02 +0000
Subject: RE: [PHP-DB] calling a column into a popup
Groups: php.db 
Request: Send a blank email to php-db+get-8818@lists.php.net to get a copy of this message
becky the code below is spot on (nearly) stick it on a form that calls itself change the <option name= to <option value= and when you refresh the form $company will contain the comany name. you can also use selected in the folowing manner $regs = pg_Exec($conn, "select region_id, region_name from region where ".$depdisplay." is not null order by ".$depdisplay." "); $numregs = pg_numrows($regs); echo '&nbsp;Region&nbsp;&nbsp;<select name="reg" onChange="document.thisForm.submit()">'; echo '<option value=0>Choose a Region</option>'; for ($s=0; $s<$numregs; $s++) { $reglist = pg_fetch_array($regs,$s); echo'<option value="'.$reglist["region_name"].'"'; print ($region == $reglist["region_name"]) ? " SELECTED":" "; echo '>'.$reglist["region_name"].'</option>'; } echo'</select>'; > -----Original Message----- > From: Beckie Pack [mailto:bpack@vsat.net] > Sent: 23 April 2001 15:29 > To: php-db@lists.php.net > Subject: Re: [PHP-DB] calling a column into a popup > > > That's almost it. I want to populate the menu automatically from the > database without having to manually modify the HTML. I > believe the below > will pull the data but it doesn't modify the menu in HTML. I > tried a few > things like using the variable name as the same as the > co_name but the menu > always comes up blank unless I put an option name in the > list. it doesn't > pass the variable for $co_name in the HTML. > > thanks, > boo > > > From: "Johannes Janson" <johannes.janson@gmx.de> > > Date: Sun, 22 Apr 2001 21:49:36 +0200 > > To: php-db@lists.php.net > > Subject: Re: [PHP-DB] calling a column into a popup > > > > Hi, > > > > let me get this right. What I understood is the following: > > > > 1. Your admin page where you enter the information of a company > > 2. A Page with a drop-down list where all the company names > are listed. > > (These names should then be linked to an information page with more > > info?) > > 3. A page where new companies can be added. > > > > well the drop-down list you can do with a simple while and > a select(html) > > like > > this: > > $result = mysql_query("SELECT companyName FROM companyTable ORDER BY > > companyName"); > > echo "<select name=company>"; > > while (list($c_name) = mysql_fetch_array($result)) { > > echo "<option name=$c_name]>$c_name</option>"; > > } > > > > If this is what you want (what I'm not sure about) I'm glad > I understood > > you. If not supply more detailed information. > > > > Cheers > > Johannes > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.db (#8818) next »