View Full Version : Pass textbox value to button value.

08-02-2011, 05:32 PM
Is there a way to have a button take the value of a textbox on the same page and append the value to an existing string, which the button would use for a href link. Ex:

Enter the class date (format ddmmyy)<br>
<input type= "text" name = "classlink"><p><br> //input from the user


$str1 = "http://siteaddress/";
$str2 = 'classlink';
$str3 = ".wmv";

$str4 = $str1.$str2.$str3; //combine the strings

echo "<a href=", $str4, ">Test</a><br><br>";


<input type= "button" value="Enter" ONCLICK= '$str4'><br> //link to a file using the value from the text box as part of the link address.

Thanks for the help, kind of new to web page coding so if theres a way to do this using just html code that would be even better.