homepage Welcome to WebmasterWorld Guest from 54.198.9.77
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

    
Generate Link using HTML form
foxxchaser




msg:4007646
 4:26 pm on Oct 15, 2009 (gmt 0)

i'm looking for a way to make a form that a customer will enter a work order # into

EX. 123

and have the form direct them to

www.mysite.com/123.html
or even
www.mysite.com/123/index.html

i have tried using the "GET" method but i cant get it working

does it require a GCI script to process?

is there anyway around that

thanks for reading i look foward to a responce

 

rocknbil




msg:4007767
 6:22 pm on Oct 15, 2009 (gmt 0)

Welcome aboard foxxchaser, there are probably a lot of ways to do this but here is how I would do it.

I would indeed use a dynamic scripting language like Perl or PHP. Enter 123, form posts to a script, the script creates "123.html" out of the input, first checks to make sure 123.html exists, if it exists, redirect to it. If it does not exist, re-output the form from within this script with the message that the resource doesn't exist, try again.

You could do the same thing with a bit of Javascript in which case no server side scripting is required, but the problem there is that it doesn't work if JS is disabled.

A third possibility is to manage the entire process within an .htaccess file using mod_rewrite directives and the same logic.

i have tried using the "GET" method

With what technology/language receiving it?

<form method="get" action="test.php">

Will capture $_REQUEST or $_GET input,

<form method="post" action="test.php">

Will capture $_REQUEST or $_POST input.

foxxchaser




msg:4008046
 4:20 am on Oct 16, 2009 (gmt 0)

Thanks for the info i would like to go with the Php option because some of our users will be on computers that may have JS disabled.

the only problem is i don't know where to start

i have a server that will handel the processing at a diffrent domain

could you direct me to a place with some example php code so i can get started writing the processing script

Thanks for your quick reply

-Vincent Ellis

foxxchaser




msg:4008057
 5:13 am on Oct 16, 2009 (gmt 0)

i've been messing around with the code

this is what i have come up with so far

<!-- PHP Processor -->
<?php
$WOnumber = check_input($_POST['WOnumber']);
?><html>
<body>Please click the link below to view the progress of your repair<br>
<br>

<a href="http://www.mysite.com/<?php echo $WOnumber; .htm><br />
<br />
</body>
</html>

<!-- Form code -->
<html>
<body>
<form action="http://www.my-php-server/test.php" method="post">
<p>Workorder #: <input type="text" name="WOnumber" /><br />
<p><input type="submit" value="Submit"></p>
</form></body>
</html>

<!-- Error i keep getting -->

Parse error: syntax error, unexpected '.' in /mnt/Web/test.php on line 7


Well i kept messin with it and i got it to do this

Please click the link to see progress [mysite.com...]

THANKS SOOOOOO MUCH YOU JUST SAVED MY JOB

if you ever need any computer help just contact me and i will help in any way i can

my e-mail address is help@elliscomputerdesign.com


<!-- This was the final code i used -->

PHP Processor

<?php
$workorder = check_input($_POST['workorder']);

?>

<html>
<body>Please click the link to see progress [mysite.com...] echo $workorder; ?>.htm<br />
</body>
</html>

<?php
function check_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>

HTML Form

<form action="http://www.mt-php-server/test.php" method="post">
<p>Please enter Workorder number<input type="text" name="workorder" /><br>

<p><input type="submit" value="Send it!"></p>
</form>

rocknbil




msg:4008437
 7:04 pm on Oct 16, 2009 (gmt 0)

Wow, for someone who doesn't know where to start it looks like you just about got it! Just create a link, like this

<p>Please click the link to see progress: <a href="http://www.mysite.com/<?php echo $workorder;?>.htm"><?php echo $workorder;?>.htm</a></p>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved