You are here: Re: Pass values from form using URL « PHP Programming Language « IT news, forums, messages
Re: Pass values from form using URL

Posted by Jerry Stuckle on 10/23/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
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация