View Full Version : Need Help Scripting Php!
darshan1994
12-31-2008, 08:22 PM
I need help in a php script. I want to make a form which, when user enters a name it adds it to my link and shows this link in iframe.
eg
<form action="Untitled-10.php" method="post">
Name:
<input type="text" name="name" />
<input type="submit" value="Submit!"/>
</form>
i would like the name to be placed in a link eg http:yourname.com/"name"/free
could someone help me get the name into the speechmarks and show the url in an iframe. thx for looking/helping in advance.
i am wondering wat goes inside the other php file i got "Untitled-10.php".
PLEASE HELP ME OUT!!
So you mean each user would have there own directory?
darshan1994
12-31-2008, 08:31 PM
its not for each user to have their own directory but thats a eg
l_kris06
12-31-2008, 08:31 PM
File A : Test.html (assumed)
<form action="Untitled-10.php" method="post">
Name:
<input type="text" name="name" />
<input type="submit" value="Submit!"/>
</form>
File: Untitled-10.php
<?php
$name = $_POST['name'];
if($name!=""){
$redirectedURL = "http:yourname.com/".$name."/free";
header('Location: '.$redirectedURL );
exit;
}else{ //user entered no values, u can use javascript on test.html for validation otherwise.
header('Location: Test.html'); //you can set a session message if you like by using $_SESSION['<name>'] for notification or if sessions aint good, check out $_GET
exit;
}
darshan1994
12-31-2008, 08:32 PM
its gonna be like a search engine where they type and the script does the work and show them the page
darshan1994
12-31-2008, 08:33 PM
kris thx but could u get that script into iframe, i am very newbie to php
I would not suggest using an iframe... Ajax is highly suggest by me though.
l_kris06
12-31-2008, 08:36 PM
I dint quite really get what you are looking for.
you wanted somebody to type a text and then pass that value in the URL and show the result in an iframe ? is that rite?
Best,
Kris A
darshan1994
12-31-2008, 08:36 PM
niles (i don't understand ajax at all) i need iframe i can place in one of my page
You don't have to code raw ajax. You can use jQuery (http://jquery.com).
darshan1994
12-31-2008, 08:38 PM
ok here is the trust well i found this web. gives u free music to listen.
i am trying to make a search box so the user searches the music they want and the website will get it
this is how it does it
http://website.com/42424242"Name"432
Try applying this to kris's code:
http://docs.jquery.com/Ajax
If you can't do it - Just ask...
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.