Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > HTML Programming

HTML Programming Forum discussion covering HTML, XHTML, DHTML and all flavors of HTML. Hypertext Markup Language is used to create websites.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-02-2008, 08:57 PM
beastilio beastilio is offline
Newbie
 
Join Date: Apr 2007
Posts: 10
Rep Power: 0
beastilio is on a distinguished road
Default Forms, Inputs and Variables :-/

Hey all,

I want to have code that will take a user to a site that they specify.

For example: John puts 'google' in the input box. The form will then send him to Google. So whatever SITENAME is it goes to www.<whatever it is>.com

Any help please? Will I need JavaScript?


Code:
<form name="input" action="http://www.SITENAME.com" method="get">
 
<input type="text" name="SITENAME" value="" size="20">
<input type="submit" value="Submit">

</form>
Thanks,

-Beastilio
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-02-2008, 11:47 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,817
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

untested:
PHP Code:
<?php
if(isset($_GET['SITENAME']) {
    
header("Location: http://www.{$_GET['SITENAME']}.com");
}
?>

<form name="input" action="index.php" method="get">
<input type="text" name="SITENAME" value="" size="20">
<input type="submit" value="Submit">
</form>
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-03-2008, 07:02 PM
beastilio beastilio is offline
Newbie
 
Join Date: Apr 2007
Posts: 10
Rep Power: 0
beastilio is on a distinguished road
Default

Thanks! Much appreciated

Do I simply copy and paste this in index.html body? I am a newb at php :-/

Thanks again though

-Beastilio
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-03-2008, 07:45 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,817
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

You would need to rename the index.html file to index.php - then assuming your host supports PHP, all you will need to do is copy/paste. I should note, this is also possible to do with JavaScript - but I'm not a huge fan of server side scripting.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-03-2008, 07:57 PM
beastilio beastilio is offline
Newbie
 
Join Date: Apr 2007
Posts: 10
Rep Power: 0
beastilio is on a distinguished road
Default

Thanks again

just ONE last question :P

I changed the code to
Code:
<?php
if(isset($_GET['SITENAME'])) {
    header("Location: http://www.{$_GET['SITENAME']}.com");
}
?>

<form name="input" action="index.php" method="get">
<input type="text" name="SITENAME" value="" size="20">
<input type="submit" value="Submit">
</form>
All I did was add a ')' to the second lind (as I got an "unexpected '{'" error) Also, know I get this

Quote:
Warning: Cannot modify header information - headers already sent by (output started at /index.php:8) in /index.php on line 10
Thanks again :-)

-Beastilio
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 01-03-2008, 08:36 PM
beastilio beastilio is offline
Newbie
 
Join Date: Apr 2007
Posts: 10
Rep Power: 0
beastilio is on a distinguished road
Default

Nevermind, fixed. Thanks!

Beastilio
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-04-2008, 12:41 PM
TcM's Avatar   
TcM TcM is offline
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,360
Rep Power: 67
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default

Quote:
Originally Posted by Sidewinder View Post
but I'm not a huge fan of server side scripting.
I think you mean of client side scripting...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-04-2008, 07:10 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,817
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

Indeed
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 09:31 AM.

Contest Stats

Xav ........ 162.68
Sacback ........ 120.05
alearb8 ........ 120.05
tfusion ........ 120
amr2107 ........ 120
d3s!gn ........ 120
Qoolman21 ........ 120
Pillager ........ 108
antihero ........ 106
donfrench ........ 100.05

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 68%

Ads