All pastes #2055996 Raw Edit

Unnamed

public text v1 · immutable
#2055996 ·published 2011-05-10 02:24 UTC
rendered paste body
<html>
<body>
<?php
  if(isset($_POST['btnSubmit'])){
     //Get values from Post values here
 
     //Setup database
     $con = mysql_connect("localhost", "root");
     if (!$con)
     {
       die('Could not connect: ' . mysql_error());
     }
 
     mysql_select_db("learning", $con);
     //TODO: Set values in database

     //This will display all variables submitted to POST
     echo "<pre>";
     print_r($_POST);
     echo "<//pre>";
     echo "Modify insert statement below this one with the values above";
     $result = mysql_query("----INSERT STATEMENT HERE----");
     //Setting insert added flag
     $insert_complete = TRUE;
  }
?>
 
<?php if(isset($insert_complete)){
  Insert Success. <a href="insert.php">Reset</a>
<?}else{?>
  <form action="insert.php" method="post">
  Name: <input type="text" name="name" />
  Email: <input type="text" name="email" />
  Age: <input type="int" name="age" />
  <input type="submit" name="btnSubmit"/>
  </form>
<?}?>
 
 
 
</body>
</html>