-
Need Help Scripting Php!
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?
-
its not for each user to have their own directory but thats a eg
-
File A : Test.html (assumed)
Code:
<form action="Untitled-10.php" method="post">
Name:
<input type="text" name="name" />
<input type="submit" value="Submit!"/>
</form>
File: Untitled-10.php
PHP Code:
<?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;
}
-
its gonna be like a search engine where they type and the script does the work and show them the page
-
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.
-
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
-
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.
-
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...