All pastes #447919 Raw Edit

Stuff

public php v1 · immutable
·published 2007-04-19 11:34 UTC
rendered paste body
<?php/* we have lots of fields but here is a small sample of differnet data types *//*#### ADD ROUTINE$form['name']       = empty ($_POST['name']) ? '' : $_POST['name'];$form['minimum']    = empty ($_POST['minimum']) ? 1000 : $_POST['minimum'];$form['maximum']    = empty ($_POST['maximum']) ? 0 : $_POST['maximum'];$form['percentage'] = empty ($_POST['percentage']) ? 0 : $_POST['percentage'];$form['email']      = empty ($_POST['email']) ? '' : $_POST['email'];$form['price']      = empty ($_POST['price']) ? '0.0' : $_POST['price'];*/#### EDIT ROUTINE$form['name']       = empty ($_POST['name']) ? form['name'] : $_POST['name'];$form['minimum']    = empty ($_POST['minimum']) ? $form['minimum'] : $_POST['minimum'];$form['maximum']    = empty ($_POST['maximum']) ? $form['maximum'] : $_POST['maximum'];$form['percentage'] = empty ($_POST['percentage']) ? $form['percentage'] : $_POST['percentage'];$form['email']      = empty ($_POST['email']) ? $form['email'] : $_POST['email'];$form['price']      = empty ($_POST['price']) ? $form['price'] : $_POST['price'];/* Check for all required fields */if (!empty ($_POST)){  $check = array (    'name',    'minimum',    'maximum',    'percentage',    'email',    'price'  );  foreach ($check as $val)  {    /*    Error validation for all required fields. Some fields contain 0 which is an allowed input so we use the following to do the check    strlen($_POST[$val]) === 0    $_POST[$val] == ''    */    if (!isset ($_POST[$val]) || $_POST[$val] == "")    {      echo '<br />' . $val;		// DEBUG CODE      $error = 'Please complete all required fields.';    }  }    echo "DO MAGIC HERE";  }?>