p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: New to php


Message #1 by "Denan Kaligis" <matulandi@h...> on Mon, 3 Feb 2003 13:24:53 +0700
Hi.. can anyone help me with this problem please? (I have only started
learning PHP today) 
 
I created a simple page (using windows XP and IIS). The code is listed
below:
 
<html>
 
<form>
            Enter a word below: <br>
            <INPUT TYPE = TEXT  NAME=username >
            <br>
            <br>
            <INPUT TYPE = SUBMIT  VALUE = "Submit me">
            <br>
            <br>
</form>
            You typed :
            <?php
            ECHO ($username); ?>
</html>
 
As you can see, this page is intended to prompt for user input and
display it at the end.
However, when I opened it using IE, the result is :
 
Notice: Undefined variable: username in c:\inetpub\wwwroot\input1.php on
line 14 
 
Does anyone know what's wrong here? Thanks a lot.
 

Message #2 by "Gellings, C.O." <gellingsco@p...> on Mon, 03 Feb 2003 09:09:39 +0100
Where is the code to enter the word and how do you submit it??
normally one uses a form with a submit button and an input field like:
<?
if(!isset($_GET["username"]) && $_GET["username"] != ''){
?>
<form method="get" value="input1.php">
Enter a word below <br>
<input type="text" name="username" value=<?=$username;?>
<input type="submit" value="submit" name="submit">
</form>
<? }else{ ?>
You typed: <?=$_GET["username"];?>
}
?>

m.t.h.

Carl 


  Return to Index