PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
How would I go about this. What I want to do is have a user submit a form which is a search. I want to take that to a intermediate page to do a bunch of logic on the form input. From that intermediate page I want to resubmit it through PHP code to a results page.
<form enctype="multipart/form-data" id="grandSearch" name="grandSearch" action="grandSearch.php" method="post">
<input type="text" name="grandSearch" value="Type your City Name here" />
<input class="button" type="submit" value="Submit" />
</form>
I then want to process the data of this form. Have it ran through a series of logic. Depending on how I process this data I want to re-post the data to a new searchResults page. So can I create a form through PHP code and submit it? I almost want to say I want the php code to fake a user inputted form.
If you can just point me in the right direction I will be very grateful. Thank you.
To get each intermediate page to post you'll have to use javascript to do the posting on the intermediate pages. The better approach would be to use sessions or redirects with get vars:
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Stacks wrote:Thanks for the reply. I wanted to avoid using redirects and query strings. So you are telling me there is no way to fake a form submission?
I am almost certain there must be some kind of way to do this through the request object.
I'm looking into using the HTTPREQUEST object. Maybe I can fake a form post with this. If I figure it out I will post back here.
You can post with PHP but the browser won't redirect to the resultant page. I assume since you talked about a results page that you would need the browser to redirect there. Check this: viewtopic.php?f=1&t=113435&p=595834#p595847
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.