intervet

process_insert.php

Mar 19th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2. //POST-DATA
  3. $A_ID = mysql_real_escape_string($_POST['A_ID']);
  4. $row = mysql_real_escape_string($_POST['row']);
  5. $year = mysql_real_escape_string($_POST['year']);
  6. $quality = mysql_real_escape_string($_POST['quality']);
  7. $value = mysql_real_escape_string($_POST['value']);
  8. $type = mysql_real_escape_string($_POST['type']);
  9. $country = mysql_real_escape_string($_POST['country']);
  10. $notes = mysql_real_escape_string($_POST['notes']);
  11. $is_roll = mysql_real_escape_string($_POST['is_roll']);
  12.  
  13.  
  14. $action = mysql_real_escape_string($_REQUEST['do']);
  15. switch($action){
  16.    case "add":
  17.         //Check for requiered values
  18.         if ($A_ID == '' || $row == '' || $year == '' || $quality == '' || $value == '' || $type == '' || $country == '---') {
  19.         header('Location: /insert.php?do=fail');
  20.         break;
  21.         }
  22.         include ('db_connect.php');
  23.         $query = "INSERT INTO `coin_bases` (`id`, `A_ID`, `row`, `year`, `quality`, `value`, `type`, `country`, `notes`)
  24.         VALUES (NULL,'$A_ID','$row','$year','$quality','$value','$type', '$country', '$notes')";
  25.         mysql_query($query);
  26.         mysql_close();
  27.         header('Location: /insert.php?do=success');
  28.         break;
  29.        
  30.    case "addroll":
  31.         //Check for requiered values
  32.         if ($A_ID == '' || $year == '' || $quality == '' || $value == '' || $type == '' || $country == '---') {
  33.         header('Location: /insert.php?do=fail#tab2');
  34.         break;
  35.         }
  36.         include ('db_connect.php');
  37.         $query = "INSERT INTO `coin_bases` (`id`, `A_ID`, `year`, `quality`, `value`, `type`, `country`, `notes`, `is_roll`)
  38.         VALUES (NULL, '$A_ID', '$year','$quality','$value', '$type', '$country', '$notes', '$is_roll')";
  39.         mysql_query($query);
  40.         mysql_close();
  41.         header('Location: /insert.php?do=success_roll#tab2');
  42.         break;
  43. }
  44. exit;
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment