Jump to content

jiameow

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by jiameow

  1. thanks for your help we already solved it.. thanks alot for your kindness
  2. D:\xampp\htdocs\def\admin-addservices.php
  3. $service = protect($_POST['services']);
  4. invalid name of service! "Undefined index: service D:\xampp\htdocs\def\admin-addservice.php on line 93
  5. <?php function protect($string) { $string = mysql_real_escape_string($string); $string = strip_tags($string); $string = addslashes($string); return $string; } function connect () { $con = mysql_connect("localhost", "root",'') or die(mysql_error()); $db = mysql_select_db("patient", $con); } ?>
  6. it holds the protect function and connection
  7. we dont have any knowledge about php so far :/
  8. here is our full code <?php include_once "add2.php"; connect(); mysql_connect("localhost","root",""); mysql_select_db("patient"); if (!isset($_POST['submit'])){ echo "<form method=\"post\" action=\"admin-addservice.php\" name=\"Registration Form\">"; echo "<br/>"; echo 'Name of Service: ' . '<br/>' . '<input type=\"text\" name=\"services\" style="width:400px;"/>' . '<br/>' . '<br/>'; echo "Description: " . "<br/>"; //echo '<textarea cols="80" rows="10" name=\"description\" maxlength=\"1000\" style=\"overflow: hidden;\">'; //echo '</textarea>' . '<br/>' . '<br/>'; echo "<input type=\"text\" name=\"\">"; echo "Price: " . '<br/>'; echo "<input type=\"text\" name=\"price\" style='width:200px;'/>" . '<br/>'; echo "<input type=\"submit\" name=\"submit\" value=\"Finish Registration!\" />"; echo "</form>"; }else { $service = protect($_POST['services']); $description = protect($_POST['description']); $price = protect($_POST['price']); $errors = array(); if(!$service) { $errors[] = "Invalid Name of Service!"; } if(!$description) { $errors[] = "Invalid Description!"; } if(!$price) { $errors[] = "Invalid Price!"; } if (count($errors) > 0) { foreach($errors AS $error) { echo ("<SCRIPT LANGUAGE='JavaScript'> window.alert('$error') window.location.href='admin-addservice.php' </SCRIPT>"); } } else { $sql = "INSERT INTO services(services , description , price) VALUES('$_POST[services]' , '$_POST[description]' , '$_POST[price]')"; $res = mysql_query($sql) or die (mysql_error()); ?> <script type=text/javascript> function show_alert() { var msg = "Successfully Saved!"; alert(msg); } </script> <?php echo "<br/>"; echo '<script type="text/javascript"> show_alert(); </script>'; echo "<br/>"; echo "<br/>"; echo "<br/>"; } } ?>
  9. <?php include_once "add2.php"; connect(); ?> <?php if (!isset($_POST['submit'])){ echo "<form method=\"post\" action=\"admin-addservice.php\" name=\"Registration Form\">"; echo "<br/>"; echo 'Name of Service: ' . '<br/>' . '<input type=\"text\" name=\"service\" style="width:400px;"/>' . '<br/>' . '<br/>'; echo "Description: " . "<br/>"; echo '<textarea cols="80" rows="10" name=\"description\" maxlength=\"1000\" style=\"overflow: hidden;\">'; echo '</textarea>' . '<br/>' . '<br/>'; echo "Price: " . '<br/>'; echo "<input type=\"text\" name=\"price\" style='width:200px;'/>" . '<br/>'; echo "<input type=\"submit\" name=\"submit\" value=\"Finish Registration!\" />"; echo "</form>"; ?> <?php }else { $service = protect($_POST['service']); $description = protect($_POST['description']); $price = protect($_POST['price']); $errors = array();
  10. how do you do that? I can't understand it :x
  11. I was wondering how can you solve this type of error "undefined index? please answer
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.