Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Input form and assign new URL to variable

Links for php scripts

Moderators: macek, egami, gesf

Input form and assign new URL to variable

Postby anhtt265 » Thu Jun 27, 2013 9:09 am

Hi all friends

I'm trying to write a PHP script

This script will submit to form for this website

http://www.yellowpages.vn

After input search fields by GET method, I want to assign the new url of searching result to a variable.

For example, I search with keyword "quan ao" and the new URL is http://www.yellowpages.vn/vn/q5551/quan-ao.html.

How can the PHP script read and assign this new URL to a variable?

I'm newbie to PHP. Please anyone give me an idea.

Thanks
anhtt265
New php-forum User
New php-forum User
 
Posts: 1
Joined: Thu Jun 27, 2013 9:04 am

Re: Input form and assign new URL to variable

Postby somdcomputerguy » Sun Sep 29, 2013 7:34 pm

This should give you the full URL of the page you're at, I don't know if this is what you need though..
Code: Select all
echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
somdcomputerguy
New php-forum User
New php-forum User
 
Posts: 14
Joined: Tue Oct 04, 2011 6:50 am
Location: West Virginia

Re: Input form and assign new URL to variable

Postby developerahusain » Sun Sep 29, 2013 9:38 pm

This is simple here is the code
<? if ($_POST ['b_submit']) {
echo "<script language='javascript'>window.location='http://www.yellowpages.vn/vn/q5551/".$_POST ['inp']."'</script>";
} ?>
<form name="asdf" method="post">
<input type="text" name="inp"><input type="submit" name="b_submit" value="Submit">
</form>

developerahusain
developerahusain
New php-forum User
New php-forum User
 
Posts: 36
Joined: Tue May 28, 2013 10:04 pm
Location: India,Lucknow


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron