In a message dated 2/13/2003 1:11:35 PM Pacific Standard Time,
[EMAIL PROTECTED] writes:

>I am new to PHP and had just written a simple php script to get things
>started.  I have the following code:
>
><?php
>if($submit1) {
>echo "hello $vname";
>} else {
>?>
><form action="thispage.php" method=post>
>
>Input yourname<input type=text name=vname>
>
><input type=submit name=submit1>
>
>
></form>
><?php
>}
>?>

>So this page is suppose to display a input box and a submit button and once
>you enter ur name and press the button, it should show Hello [ur name] and
>the input box at the bottom of it and the button below and the process
>continue.
>
>I tried running it and inputted some text and pressed the button, and the
>Hello [ur name] didn't show up, it just display an input box and the submit
>button.
>
My guess would be that you have register_globals = Off.  You can change it to
register_globals = On in your php.ini file. But it would be better to learn
to program with globals turned off. The following program would run correctly.

<?php
if($_POST['submit1']) {
      echo "hello {$_POST['vname']}";
} else {
?>
<form action="thispage.php" method="post">
Input yourname<input type="text" name=vname>
<input type="submit" name="submit1">
</form>
<?php
  }
?>

Janet


-------------------------------
Janet Valade
Author, PHP & MySQL for Dummies

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to