homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Returning db query results to the form of origin?
can this be done in PHP?

 9:58 am on Jul 31, 2003 (gmt 0)

I would like to submit a database query from a form and have the data returned to that same form and displayed in the appropriate text fields, select boxes, etc. Is this possible using PHP?



 1:22 pm on Jul 31, 2003 (gmt 0)

<input name="text" type="text" value="<? echo$var;?>">
would do text fields

This code would select day 4 in a select field of 1-31 days,
having used getdate()

while($day <32){
if($aday==$day){ $select=" selected"; }
echo"<OPTION value=\"$day\" ".$select.">".$day."</OPTION>\n";


 3:48 pm on Jul 31, 2003 (gmt 0)

You sure can. It's quite a common practice:

if ($_POST['submitbutton']) {
your processing statements here;
#display the form again:
<form method="post" action="<?php print $_SERVER['PHP_SELF'];?>">
$rows = mysql_query("SELECT * FROM tablename");
while ($row=mysql_fetch_array($rows)) {
print "<input type=\"text\" name=\"name\" value=\"$row['value']" />

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved