|
Posted by Jerry Stuckle on 12/18/16 11:51
drec wrote:
> I am creating a search box that the user types a value in, and then
> this gets passed to another page called search.php
>
> I would like to be able to pass these values through the URL, but I
> cant seem to figure out how. Right Now I have a simple html form that
> passes the value through posting, which I can then pull with a
> $_POST['name']. But I need to have this value be passed through URL.
>
If you want to pass them onto another URL, there are several ways of doing it.
If, for instance, the URL accepts GET variables, you can just do
header('www.example.com?name=' . "$_POST['name']).
If you must pass them as $POST variables, you could build a form with them as
hidden fields, send the page to the browser and with javascript immediately
submit the page. But depending on the user's browser, this might cause an
unwanted flask in the window. Additionally, it depends on the user having
javascript turned on.
A better (but more a little more complicated) way is to user Curl to submit the
values to the new page.
The most complicated (but doesn't depend on outside libraries) would be to open
a socket to the new site, send the HTTP headers, fetch the response and send it
to the user's browser.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|