<HTML>
<FORM>
please enter name :<BR>
<INPUT TYPE="text" NAME="username"><BR><BR>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
<BR>
<?php
echo($username);
?>
</HTML
newbi need help!! why the name cannot display after submit ?
Moderator: General Moderators
You didn't provide a method for the forum, so it's likely to go into $_GET mode. Do:
and have a read at:
viewtopic.php?t=511
-Nay
Code: Select all
print $_POST['username'];viewtopic.php?t=511
-Nay
it still does't work !
if i enter lengchai in the input textbox
the only changes will be the url :
http://localhost/test.php?username=lengchai
but i still cant display "lengchai"
if i enter lengchai in the input textbox
the only changes will be the url :
http://localhost/test.php?username=lengchai
but i still cant display "lengchai"
Leng Chai? Cantonese? haha.......lei leng meh?
Anyhow like I said, that's because you didn't specify the method.
by right it should be:
-Nay
Anyhow like I said, that's because you didn't specify the method.
Code: Select all
print $_GET['username'];Code: Select all
<?php
if(isSet($_POST['submit']) {
echo $_POST['username'];
} else {
echo <<< FORM
<form id="form" action="test.php" method="post">
<input type="text" name="username" />
<input type="submit" value="Submit" />
<form>
FORM;
}
?>