Page 1 of 1

printing php variables on html forms

Posted: Sat Jul 27, 2002 4:14 pm
by Aundry
Well, the title is somewhat self vague, but basically, I want to use a php echo to print the values of the variable of an html form. Php is installed on my system, but when I run the code the spaces where I put in a $variablename, the html and other text comes out, but it doesn't print the value of the variable. How can I fix this, or is there something I can do?

This is an example of the form source:
<form action="code.php" method=post>
<input type=text name="variable1" value="blue">
<input type=submit value="send">
</form>

This is the php code that I send the results of the above form:
<?php
echo "I like $variable1";
?>

If you know whats wrong, please help me.

Posted: Sat Jul 27, 2002 9:11 pm
by trevorj
try

Code: Select all

<?php 
echo "I like ".$_REQUEST&#1111;'variable1']; 
?>
:mrgreen:

Posted: Sun Jul 28, 2002 1:43 am
by newgent
maybe $_POST['variable1'] is better for that condition ?

Posted: Sun Jul 28, 2002 10:06 am
by twigletmac

thanks

Posted: Mon Jul 29, 2002 4:18 pm
by Aundry
thank you! that helped ^_^

Posted: Tue Jul 30, 2002 1:49 am
by twigletmac
That's why it's a sticky... (and says 'Before post read')

Mac