By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

Pass values from form using URL

P: n/a
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.

Jun 27 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

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.


Hello Drec
Your problem can be solved by replacing the $_POST with $_GET['name']
I guess that the value of method in the form tag is :
<form .... method="POST"....>
so u have to replace it with method="get" in this case u can see what u
r passing in the url.

Chamirame Sadaki

Jun 27 '06 #2

P: n/a
<comp.lang.php>
<drec>
<27 Jun 2006 07:10:55 -0700>
<11**********************@m73g2000cwd.googlegroups .com>
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.


$_REQUEST['name']
$_REQUEST['demo']
$_REQUEST['blah']

whatever.php?name=ONE&demo=TWO&blah=THREE
--
www.emailuser.co.uk/?name=KRUSTOV
Jun 27 '06 #3

P: n/a
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.
js*******@attglobal.net
==================
Jun 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.