Page 1 of 1
How to pass the URL via GET method?
Posted: Mon May 25, 2009 12:09 am
by charoo1983
Hello !
Plz hep me out. What will be the procedure to pass the URL via GET method.
Like-
If I make a form of Name & Email address and Submit button.When the user fills name, email and click submit button the next page should be of Thankyou page which will take the user directly to my offer page.
Looking fwd for earliest reply.
Thanks & Regards,
Charoo
Re: How to pass the URL via GET method?
Posted: Mon May 25, 2009 12:12 am
by mikemike
Hi Charoo,
I'm not sure what you mean by the first question.
Plz hep me out. What will be the procedure to pass the URL via GET method.
But I can help you with the later.
Page 1:
Code: Select all
<form action="page2.php" method="get">
<label for="name">Name</label>
<input type="text" name="name" id="name" />
<label for="email">Email</label>
<input type="text" name="email" id="email" />
<button type="submit">Continue</button>
</form>
This will page all variables across to 'page2.php' which are accessible via GET...
Page 2:
Code: Select all
<?PHP
echo 'Thanks, '.$_GET['name'].' for registering with the email address: '.$_GET['email'].'.';
?>
Hope this helps.
Mike
Re: How to pass the URL via GET method?
Posted: Mon May 25, 2009 12:20 am
by charoo1983
Thanks Mike

for the earliest reply. Well I just want to know there is some procedure from which website address can be made passed...
Re: How to pass the URL via GET method?
Posted: Mon May 25, 2009 12:25 am
by mikemike
Again I'm not 100% sure what you're after.
If you want the full website address (
http://www.example.com/page.html?this=is&a=query) then here is a function you may find useful.
Code: Select all
function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2) {
return substr($s1, 0, strpos($s1, $s2));
}
Re: How to pass the URL via GET method?
Posted: Mon May 25, 2009 12:29 am
by charoo1983
Mike I just want to connect my website through GET method...
Re: How to pass the URL via GET method?
Posted: Mon May 25, 2009 12:48 am
by mikemike
You're going to have to explain exactly what you're trying to do, you've asked for 3 different things now and I've given you good, thorough answers to each of them - explain exactly what you mean and what you're trying to do. To me 'connecting to my website through get' means using sockets to grab a webpage using GET - but I doubt that's what you're after if you're on about registration forms

Re: How to pass the URL via GET method?
Posted: Mon May 25, 2009 12:53 am
by charoo1983
Do you have skype ID?
Re: How to pass the URL via GET method?
Posted: Mon May 25, 2009 1:07 am
by mikemike
I'm afraid not no. I'm behind all sorts of anti-freedom devices (firewall, etc) too so it wouldn't work even if I did.
Just post here so that others can help too.