Saying "Hello" : Form Data « Form « PHP






Saying "Hello"

 
<?
if (array_key_exists('my_name',$_POST)) {
    print "Hello, ". $_POST['my_name'];
} else {
    print<<<_HTML_
<form method="post" action="$_SERVER[PHP_SELF]">
 Your name: <input type="text" name="my_name">
<br/>
<input type="submit" value="Say Hello">
</form>
_HTML_;
}
?>
  
  








Related examples in the same category

1.Deal with Array Form Data
2.A process_form() Function
3.Access widget's form value
4.Accessing multiple submitted values
5.Calculation based on form data
6.Forms and PHP
7.Feedback Form
8.Handling Special Characters
9.multivalue-forms.php