Retrieve Posted Data
2003-03-16 14:16:59
Category: php:cgi
Description: Example on posting data to php.
Author: detour
Viewed: 3219
Rating: (5 votes)


<?php
  /* post.php by detour@metalshell.com
   *
   * Example on posting data to php.
   *
   * http://www.metalshell.com/
   *
   */
 
// If submit button was hit, info_sub will not return null
if($_POST["info_sub"]) {
  // Check to make sure both fields where filled out
  if($_POST["title"] && $_POST["url"]) {
    echo('<H3>You Entered: </H3>');
    echo('Title: ' . $_POST["title"] . '<br>');
    echo('URL:  ' . $_POST["url"] . '<br>');
  } else {
    // They left something blank.
    echo('<H3>Field Missing</H3>');
  }
}
 
?>
 
<form method="post">
<table align="center">
<tr>
  <td>Title: </td>
  <td><input type="text" name="title" value=""></td>
</tr>
<tr>
  <td>URL: </td>
  <td><input type="text" name="url" value=""></td>
</tr>
</table>
<center><input type="submit" value="Submit URL" name="info_sub"></center>
</form>