It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

Text Box that changes current URL

Text Box that changes current URL

Postby kame on Wed Jul 18, 2007 3:39 pm

I know just about nothing of HTML. Last night, I was trying for hours to make a text box that when you type something and hit submit, it changes the current url to ____.com/(whatever you typed).html

My code looks like this:
<FORM ACTION="">
Your Answer: <INPUT answer="">
<input type="image" name="submit" src="http://www.idiotsguidetowebmarketing.com/images/cool_arrow_v.gif" />
</FORM>

Whenever someone types something in, it tacks on ?=(what was typed in) to the end of the web address. I am not allowed to have ? or = in the address. How do I get it to say (answer).html. When I put ".html" after form action, it just adds .html?=(what was typed in)

Please help, I hardly know anything about HTML
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby flabbyrabbit on Wed Jul 18, 2007 9:46 pm

You would need to use somthing else, e.g. javascript. you would need to change the form submit button to:
Code: Select all
<input type="image" name="submit" onClick="Change()"


You will need to have a quick look at javascript but it should be fairly straight forward.

Flabby Rabbit
Image
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England

Postby kame on Sat Jul 21, 2007 3:36 am

I've been trying for soo long. What goes in Change()? How do I just make it redirect to whatever was put into the box?
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby flabbyrabbit on Sat Jul 21, 2007 7:31 pm

you could put what ever you wanted in the onClick property. It will have to link to a javascript function. Google for a peice of javascript code that will redirect the page. Then when you click the button you want it to perform the peice of javascript, so will need to be linked to the function.

I will write you some code as soon as i can, then i will post it for you.

Flabby Rabbit
Image
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England

Postby DDragon on Sun Jul 22, 2007 10:15 am

kame, try this for your form:
Code: Select all
<form name="frmUrl" method="post" action="url.pl">
Your url: <input type="text" name="txtUrl">
<input type="image" src="manual.jpg" name="submit">
</form>

thats the form (basically) if you need help with the perl program ill post it for you if you like
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby kame on Mon Jul 23, 2007 6:18 pm

Cool! Now it changes the end to just "url.pl" and no more ? or =! I just need to know how to make whatever you typed appear in the url. I thought it was ('txturl'), but that isn't working.
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby DDragon on Tue Jul 24, 2007 11:37 am

ok what we need to do now is make the Perl script (url.pl)

ill post what you need...

Code: Select all
#!/usr/bin/perl -T
# url.pl
# Anthony Gilbert (AKA DDragon)

use CGI ':standard';

my $address, $url;

$address = param('txtUrl');
$url = "http://www." . $address . ".com";

print "Location: $url\n\n";


with this code place it in the cgi-bin directory on your webserver and make sure that before you paste and save the file that the 'txtUrl' matches the exact way it is typed here:
Code: Select all
<form name="frmUrl" method="post" action="url.pl">
Your url: <input type="text" name="txtUrl">
<input type="image" src="manual.jpg" name="submit">
</form>
Last edited by DDragon on Sun Aug 05, 2007 7:57 am, edited 1 time in total.
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby kame on Tue Jul 24, 2007 3:00 pm

I copied that both codes and put them in the proper places exactly as you had shown, but it still does url.pl. Am I supposed to customize things in the perl script? I pasted it into a blank file in cgi-bin and named it url.pl.

I hardly know anything about scripting, thank you for being patient.
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Postby DDragon on Sat Jul 28, 2007 3:32 pm

ok have you got this up on a webserver or is it a local site (ie do you use WAMP or something like it to look at your site on your computer?)
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia

Postby kame on Sun Jul 29, 2007 2:03 am

I don't know. Is filemanager a method? It's tripod.
kame
 
Posts: 13
Joined: Wed Jul 18, 2007 3:30 pm

Next

Who is online

Users browsing this forum: No registered users and 5 guests