plushgirl Posted April 9, 2008 Share Posted April 9, 2008 I am trying to pass a variable from a php script to an html form so when the user clicks submit, the variable is sent with the form to my email. I can get the variable to display on the page, but I can't put it in the form. What am I doing wrong??? Here's the php script: <?php $template = "domain_reg.html"; $registerlink = "signup.php"; $restrict = 0; $REFERERS = array('plushwebdesign.ca', 'www.plushwebdesign.ca'); error_reporting(0); if ($_SERVER['REQUEST_METHOD'] == 'GET'){ $domain = $_GET['domain']; $ext = $_GET['ext']; $option = $_GET['option']; }else{ $domain = $_POST['domain']; $ext = $_POST['ext']; $option = $_POST['option']; } print_results(); echo "The following domain will be registered for you: "; echo $domain; function print_results() { global $template,$domain,$ext,$server; if(!is_file($template)){ print"The template file into which to print the results either does not exist or is not writeable<br> please correct this if you are the webmaster of this site<br> The script can not continue exiting......"; exit; } $template = file ($template); $numtlines = count ($template); $line = 0; while (! stristr ($template[$line], "<!--DOMAIN RESULTS-->") && $line < $numtlines) { echo $template[$line]; $line++; } } And here's the html: <html> <body> <form id="form" action="form2.php" enctype="multipart/form-data" name="form"> <input type="hidden" name="mydomain" value="" /> <a href="domain_reg_done.html" onclick="document.getElementById('form').submit()"> <img src="images/send.gif" alt="" /></a> <!--DOMAIN RESULTS--> </form> </body> </html> I've tried <%php echo $GET_['domain']; %> and it doesn't work. Link to comment https://forums.phpfreaks.com/topic/100328-passing-variable-php-to-html-form/ Share on other sites More sharing options...
darkfreaks Posted April 9, 2008 Share Posted April 9, 2008 <?php echo $domain ?> Link to comment https://forums.phpfreaks.com/topic/100328-passing-variable-php-to-html-form/#findComment-513017 Share on other sites More sharing options...
darkfreaks Posted April 9, 2008 Share Posted April 9, 2008 make your html form a php form Link to comment https://forums.phpfreaks.com/topic/100328-passing-variable-php-to-html-form/#findComment-513019 Share on other sites More sharing options...
plushgirl Posted April 10, 2008 Author Share Posted April 10, 2008 You guys are awesome. Thanks so much for the replies Link to comment https://forums.phpfreaks.com/topic/100328-passing-variable-php-to-html-form/#findComment-513576 Share on other sites More sharing options...
darkfreaks Posted April 10, 2008 Share Posted April 10, 2008 you come up with a solution if so please click topic solved in the left bottom corner Link to comment https://forums.phpfreaks.com/topic/100328-passing-variable-php-to-html-form/#findComment-513581 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.