When you submit the form, why not have a hidden field in the form like:
<input type="hidden" name="backtopage" value="<?php echo
Then use that 'backtopage' variable in your script where you direct the
Or.. if you don't want to use a hidden field.. parse the URL to get the
> -----Original Message-----
> From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
> Sent: August 19, 2003 1:54 PM
> To: PHP-DB
> Subject: [PHP-DB] Returning Results
> OK, I'll apologize in advance if this is a little off topic, but I
> it'll be close enough.
> I have a form (searchform.php) that collects data for a search (e.g.,
> firstname, lastname). That form submits to a separate PHP script
> (search.php) that queries a database to find matching rows and returns
> information in an array ($results).
> All pretty standard stuff and it all works.
> I know I "while()" the information in the resulting array ($results)
> a table showing all of the results. But what that would require is the
> (searchform.php) to collect the data and submit to the search.php
> where HTML and PHP code combine in one file to perform the query and
> the results. I know how to do this and have done it in the past.
> However, this instance has a wrinkle to it. When the searchform.php
> submits to search.php, I want to perform the query, but return the
> the $results array) to searchform.php to display the results.
> I want to stress that I can get the information from the database with
> problem. I'm just stuck on how to get the results back to the page
> called the search.php script in the first place.
> Is turning search.php into a function and "return"-ing the results the
> way to accomplish this? Because the only other idea I can come up with
> using a header("Location:http://searchform.php?rs=$results");
> that doesn't seem to work (and logically, I can see why).
> I'm not asking for a total solution here because I can handle the
> solution myself. However I would appreciate a bump in the right
> regards to how to architect the application logic.
> Thanks in advance,
> Rich Hutchins
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php