Jump to content

VTXmom

Members
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About VTXmom

  • Rank
    Member
  1. Psycho, thank you for your help. I was very tired that night and frustrated to the point of tears , so I wasn't thinking clearly. I've taken another look at your code and was able to get my cascading dropdown to work correctly. I'm sorry to have been such a bother, I really do appreciate all the help you give us newbies. I've come to realize I do not comprehend or learn now as easily as I did in my 20's or even 30's. VTXmom
  2. Psycho, I want to thank you so much for your help and patience with me. I had trouble getting the select list to work, so I scrapped what I was doing and started completely over. I read over what you had posted and went back to the validation lessons in my textbook and I got it to work! I wanted to post my code to show you what I came up with. <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Sandy's Pet Shop</title> <link href="style.css" rel="stylesheet" type="text/css"> <div id="container"> <script type="text/javascript"> function checkLength(text, min, max) { min = min || 1; max = max || 1000; if (text.length < min || text.length > max) { return false; } return true; } function validate(form) { var FirstName = form.FirstName.value; var LastName = form.LastName.value; var Address = form.Address.value; var City = form.City.value; var State = form.State.value; var Zip = form.Zip.value; var PhoneNumber = form.State.value; var PetType = form.PetType.value; var PetName = form.PetName.value; var errors = []; //validate that a pet type is chosen if (!checkSelect(form.PetType) ) { errors[errors.length] = "Please select a pet type."; } //validate that no required fields are empty if (!checkLength(FirstName)) { errors[errors.length] = "First name is required."; } if (!checkLength(LastName)) { errors[errors.length] = "Last name is required."; } if (!checkLength(Address)) { errors[errors.length] = "Address is required."; } if (!checkLength(City)) { errors[errors.length] = "City is required."; } if (!checkLength(State)) { errors[errors.length] = "State is required."; } if (!checkLength(Zip)) { errors[errors.length] = "Zipcode is required."; } if (!checkLength(PhoneNumber)) { errors[errors.length] = "PhoneNumber is required."; } if (!checkLength(PetType)) { errors[errors.length] = "Pet type is required."; } if (!checkLength(PetName)) { errors[errors.length] = "Pet name is required."; } if (errors.length > 0) { reportErrors(errors); return false; } return true; } //checkSelect helper function to make sure first option is not selected function checkSelect(select) { return (select.selectedIndex > 0); } function reportErrors(errors) { var msg = "Please try again."; var numError; for (var i = 0; i<errors.length; i++) { numError = i + 1; msg += numError + ". " + errors[i]; } alert(msg); } </script> <?php require 'header.php'; ?> </div> </head> <body> <div> <h3 align="center">Our Services</h3> </div> <div> <p> We provide hands-on care and a variety of dog grooming services. First, choose a bath or full groom, then customize your dog's salon experience with a personalized add-on package. We also offer walk-in services that are available without an appointment. Bring your dog into our salon for a free consultation! Our academy-trained groomers will personally meet with you to discuss your dog's specific needs. They'll also recommend just the right grooming service. Book an appointment today!</p> </div> <div> <form method="post"id="form" onSubmit="return validate(this);"action="submitform.php"> <input type="hidden" name="submitted" value="true"/> <table border="1"> <tbody> <tr> <td>First Name:</td> <td><input name="FirstName" type="text" size="20" > <span class="error">* Required</span> </td> </tr> <tr> <td>Last Name:</td> <td><input name="LastName" type="text" size="20" > <span class="error">* Required</span> </td> </tr> <tr> <td>Address:</td> <td><input name="Address" type="text" size="20"> <span class="error">* Required </span> </td> </tr> <tr> <td>City:</td> <td><input name="City" type="text" size="20" > <span class="error">* Required </span> </td> </tr> <tr> <td>State:</td> <td><input name="State" type="text" size="15" > <span class="error">* Required </span> </td> </tr> <tr> <td>Zipcode:</td> <td><input name="Zip" type="text" size="5" > <span class="error">* Required </span> </td> </tr> <tr> <td>Phone Number:</td> <td><input name="PhoneNumber" type="text" size="15"> <span class="error">* Required</span> </td> </td> </tr> <tr> <td>Email Address:</td> <td><input name="Email" type="text" size="50"></td> </tr> <tr> <td>Pet Type:</td> <td> <select name="PetType"> <span class="error">* Required value</span> <option value="0">Please select</option> <option value="Cat">Cat</option> <option value="Dog">Dog</option> </td> </tr> <tr> <td>Dog Breed:</td> <td> <select name="Breed"> <option value="0">Please select</option> <option value="PitBull">Pit Bull</option> <option value="Lab">Lab</option> <option value="Chihuaua">Chihuaua</option> <option value="Terrier">Terrier</option> <option value="German Shepherd">German Shepherd</option> <option value="Other">Other</option> </select> </td> </tr> <tr> <td>Pet Name:</td> <td><input name="PetName" type="text" size="15" > <span class="error">* Required </span> </td> </tr> <tr> <td>Spayed/Neutered:</td> <td>Yes<input name="NeuteredOrSpayed" type="checkbox" value="1"> No<input name="NeuteredOrSpayed" type="checkbox" value="0"</td> </tr> <tr> <td>Pet's Birthday:</td> <td><input name="PetBirthday" type="text"</td> </tr> <tr> <td> <input type="submit" value="Submit" name="submit"</input> </td> </tr> </tbody> </table> </form> </body> <hr> <footer> <?php require 'footer.php'; ?> </div> </footer> </body> </html> I know there was probably a prettier way to do this, and I intend to work on this a lot more on my own time. I just want to thank you again for your help.
  3. I think I did something wrong, I am now getting this error: Parse error: syntax error, unexpected '{' in C:\xampp-win32-1.8.3-5-VC11\xampp\htdocs\pet-shop\grooming.php on line 80 I have checked for mismatched or missing tags and can't find anything, but I am wondering if I wrote the syntax correctly for the select lists? <?php //Create variables for form validation tracking $errors = array($firstnameErr, $lastnameErr, $addressErr, $cityErr, $stateErr, $zipError, $phonenumberErr, $emailErr, $pettypeErr, $breedErr, $petnameErr, $neuteredorspayedErr, $petbirthday); $fields = array($firstname, $lastname, $address, $city, $state, $zip, $phonenumber, $email, $pettype, $breed, $petname, $neuteredorspayed, $petbirthday); //Check if form was posted if ($_SERVER["REQUEST_METHOD"] == "POST") { //Validate POST values $fields['FirstName'] = isset($_POST['FirstName']) ? trim($_POST['FirstName']) : ''; if(empty($fields['FirstName'])) { $errors['FirstName'] = 'First name is required'; } $fields['LastName'] = isset($_POST['LastName']) ? trim($_POST['LastName']) : ''; if(empty($fields['LastName'])) { $errors['LastName'] = 'Last name is required'; } $fields['Address'] = isset($_POST['Address']) ? trim($_POST['Address']) : ''; if(empty($fields['Address'])) { $errors['Address'] = 'Address is required'; } $fields['City'] = isset($_POST['City']) ? trim($_POST['City']) : ''; if(empty($fields['City'])) { $errors['City'] = 'City is required'; } $fields['State'] = isset($_POST['State']) ? trim($_POST['State']) : ''; if(empty($fields['State'])) { $errors['State'] = 'State is required'; } $fields['Zip'] = isset($_POST['Zip']) ? trim($_POST['Zip']) : ''; if(empty($fields['Zip'])) { $errors['Zip'] = 'Zip is required'; } $fields['PhoneNumber'] = isset($_POST['PhoneNumber']) ? trim($_POST['PhoneNumber']) : ''; if(empty($fields['PhoneNumber'])) { $errors['PhoneNumber'] = 'PhoneNumber is required'; } $fields['Email'] = isset($_POST['Email']) ? trim($_POST['Email']) : ''; $fields['PetType'] = isset($_POST['PetType']) ? trim($_POST['PetType']) : ''; if(empty($fields['PetType'])) { $errors['PetType'] = 'Select type of pet'; } $fields['Breed'] = isset($_POST['Breed']) ? trim($_POST['Breed']) : ''; $fields['PetName'] = isset($_POST['PetName']) ? trim($_POST['PetName']) : ''; if(empty($fields['PetName'])) { $errors['PetName'] = 'PetName is required'; } $fields['NeuteredOrSpayed'] = isset($_POST['NeuteredOrSpayed']) ? trim($_POST['NeuteredOrSpayed']) : ''; $fields['PetBirthday'] = isset($_POST['PetBirthday']) ? trim($_POST['PetBirthday']) : ''; if(empty($fields['PetBirthday'])) { $errors['PetBirthday'] = 'Pet Birthday is optional'; } //Check if there were errors if(!count{$errors)) } ?> <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Sandy's Pet Shop</title> <link href="style.css" rel="stylesheet" type="text/css"> <div id="container"> <?php require 'header.php'; ?> </div> </head> <body> <div> <h3 align="center">Our Services</h3> </div> <div> <p> We provide hands-on care and a variety of dog grooming services. First, choose a bath or full groom, then customize your dog's salon experience with a personalized add-on package. We also offer walk-in services that are available without an appointment. Bring your dog into our salon for a free consultation! Our academy-trained groomers will personally meet with you to discuss your dog's specific needs. They'll also recommend just the right grooming service. Book an appointment today!</p> </div> <div> <form method="post"id="form" action="submitform.php"> <input type="hidden" name="submitted" value="true"/> <table border="1"> <tbody> <tr> <td>First Name:</td> <td><input name="FirstName" type="text" size="20" value="<?php if(isset($fields['FirstName']) { echo $fields['FirstName']; } ?>"> <span class="error">* Required <?php if(isset($error['FirstName']) { echo $error['FirstName']; } ?></span> </td> </tr> <tr> <td>Last Name:</td> <td><input name="LastName" type="text" size="20" value="<?php if(isset($fields['LastName']) { echo $fields['FirstName']; } ?>"> <span class="error">* Required <?php if(isset($error['LastName']) { echo $error['LastName']; } ?></span> </td> </tr> <tr> <td>Address:</td> <td><input name="Address" type="text" size="20" value="<?php if(isset($fields['Address']) { echo $fields['Address']; } ?>"> <span class="error">* Required <?php if(isset($error['Address']) { echo $error['Address']; } ?></span> </td> </tr> <tr> <td>City:</td> <td><input name="City" type="text" size="20" value="<?php if(isset($fields['City']) { echo $fields['State']; } ?>"> <span class="error">* Required <?php if(isset($error['City']) { echo $error['City']; } ?></span> </td> </tr> <tr> <td>State:</td> <td><input name="State" type="text" size="15" value="<?php if(isset($fields['State']) { echo $fields['State']; } ?>"> <span class="error">* Required <?php if(isset($error['State']) { echo $error['State']; } ?></span> </td> </tr> <tr> <td>Zipcode:</td> <td><input name="Zip" type="text" size="5" value="<?php if(isset($fields['Zip']) { echo $fields['Zip']; } ?>"> <span class="error">* Required <?php if(isset($error['Zip']) { echo $error['Zip']; } ?></span> </td> </tr> <tr> <td>Phone Number:</td> <td><td><input name="PhoneNumber" type="text" size="5" value="<?php if(isset($fields['PhoneNumber']) { echo $fields['PhoneNumber']; } ?>"> <span class="error">* Required <?php if(isset($error['PhoneNumber']) { echo $error['PhoneNumber']; } ?></span> </td> </td> </tr> <tr> <td>Email Address:</td> <td><input name="Email" type="text" size="50"value="<?php if(isset($fields['Email']) { echo $fields['Email']; } ?>"></td> </tr> <tr> <td>Pet Type:</td> <td> <select name="PetType" value="<?php if(isset($fields['PetType']) { echo $fields['PetType']; } ?>"> <span class="error">* Required value="<?php if(isset($error['PetType']) { echo $error['PetType']; }" ?></span> <option value="0">Please select</option> <option value="Cat">Cat</option> <option value="Dog">Dog</option> </td> </tr> <tr> <td>Dog Breed:</td> <td> <select name="Breed"value="<?php if(isset($fields['Breed']) { echo $fields['Breed']; } ?>"> <option value="0">Please select</option> <option value="PitBull">Pit Bull</option> <option value="Lab">Lab</option> <option value="Chihuaua">Chihuaua</option> <option value="Terrier">Terrier</option> <option value="German Shepherd">German Shepherd</option> <option value="Other">Other</option> </select> </td> </tr> <tr> <td>Pet Name:</td> <td><input name="PetName" type="text" size="15" value="<?php if(isset($fields['PetName']) { echo $fields['PetName']; } ?>"> <span class="error">* Required <?php if(isset($error['PetName']) { echo $error['PetName']; } ?></span> </td> </tr> <tr> <td>Spayed/Neutered:</td> <td>Yes<input name="NeuteredOrSpayed" type="checkbox" value="1"<?php if(isset($fields['NeuteredOrSpayed']) { echo $fields['NeuteredOrspayed']; } ?>> No<input name="NeuteredOrSpayed" type="checkbox" value="0"<?php if(isset($fields['NeuteredOrSpayed']) { echo $fields['NeuteredOrSpayed']; } ?>></td> </tr> <tr> <td>Pet's Birthday:</td> <td><input name="PetBirthday" type="text" value="<?php if(isset($fields['PetBirthday']) { echo $fields['PetBirthday']; } ?>"></td> </tr> <tr> <td> <input type="submit" value="Submit" name="submit"</input> </td> </tr> </tbody> </table> </form> </body> <hr> <footer> <?php require 'footer.php'; ?> </div> </footer> </body> </html>
  4. Thanks Psycho, I'm working on this right now, on the fields that I want to be optional, do I just leave out the error check and only write the code for the required fields? $fields['FirstName'] = isset($_POST['FirstName']) ? trim($_POST['FirstName']) : ''; if(empty($fields['FirstName'])) { $errors['FirstName'] = 'First name is required'; }
  5. It's me again, with another question. I have a form that I want to make some of the fields required, and some optional so that when the form is submitted, it a required field is empty, it displays an error. But, this is not happening, if I submit the form leaving required fields empty, it is still submitting. This is a class assignment(due EOD Friday), am I on the right track with my code? Thanks for all the help I have been getting with this project. <?php // define variables and set to empty values $firstnameErr = $lastnameErr = $addressErr = $cityErr = $stateErr = $zipError = $phonenumberErr = $emailErr = $pettypeErr = $breedErr = $petnameErr = $neuteredorspayedErr = $petbirthday = ""; $firstname = $lastname = $address = $city = $state = $zip = $phonenumber = $email = $pettype = $breed = $petname = $neuteredorspayed = $petbirthday = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["FirstName"])) { $firstnameErr = "First name is required"; } else { $firstname = ($_POST["FirstName"]); } if (empty($_POST["LastName"])) { $lastnameErr = "Last name is required"; } else { $lastname =($_POST["LastName"]); } if (empty($_POST["Address"])) { $addressErr = "Address is required"; } else { $address = ($_POST["Address"]); } if (empty($_POST["City"])) { $cityErr = "City is required"; } else { $city = ($_POST["City"]); } if (empty($_POST["State"])) { $stateErr = "State is required"; } else { $state = ($_POST["State"]); } if (empty($_POST["Zip"])) { $zipErr = "Zipcode is required"; } else { $zip = ($_POST["Zip"]); } if (empty($_POST["PhoneNumber"])) { $phonenumberErr = "Phone number is required"; } else { $phonenumber = ($_POST["PhoneNumber"]); } if (empty($_POST["Email"])) { $email = ""; } else { $email = ($_POST["Email"]); } if (empty($_POST["PetType"])) { $pettypeErr = "Pet type is required."; } else { $pettype = ($_POST["PetType"]); } if (empty($_POST["Breed"])) { $breed = ""; } else { $breed = ($_POST["Breed"]); } if (empty($_POST["PetName"])) { $petnameErr = "Pets name is required"; } else { $petname = ($_POST["PetName"]); } if (empty($_POST["NeuteredOrSpayed"])) { $neuteredorspayed = ""; } else { $neuteredorspayed = ($_POST["NeuteredOrSpayed"]); } if (empty($_POST["PetBirthday"])) { $petbirthday = ""; } else { $petbirthday = ($_POST["PetBirthday"]); } } ?> <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Sandy's Pet Shop</title> <link href="style.css" rel="stylesheet" type="text/css"> <div id="container"> <?php require 'header.php'; ?> </div> </head> <body> <div> <h3 align="center">Our Services</h3> </div> <div> <p> We provide hands-on care and a variety of dog grooming services. First, choose a bath or full groom, then customize your dog's salon experience with a personalized add-on package. We also offer walk-in services that are available without an appointment. Bring your dog into our salon for a free consultation! Our academy-trained groomers will personally meet with you to discuss your dog's specific needs. They'll also recommend just the right grooming service. Book an appointment today!</p> </div> <div> <form method="post"id="form" action="submitform.php"> <input type="hidden" name="submitted" value="true"/> <table border="1"> <tbody> <tr> <td>First Name:</td> <td><input name="FirstName" type="text" size="20"> <span class="error">* Required</span> </td> </tr> <tr> <td>Last Name:</td> <td><input name="LastName" type="text" size="20"> <span class="error">* Required</span> </td> </tr> <tr> <td>Address:</td> <td><input name="Address" type="text" size="20"> <span class="error">* Required</span></span> </td> </tr> <tr> <td>City:</td> <td><input name="City" type="text" size="20"> <span class="error">* Required</span></span> </td> </tr> <tr> <td>State:</td> <td><input name="State" type="text" size="15"> <span class="error">* Required</span></span> </td> </tr> <tr> <td>Zipcode:</td> <td><input name="Zip" type="text" size="5"> <span class="error">* Required</span></span> </td> </tr> <tr> <td>Phone Number:</td> <td><input name="PhoneNumber" type="text" size="15"> <span class="error">* Required</span></span> </td> </tr> <tr> <td>Email Address:</td> <td><input name="Email" type="text" size="50"></td> </tr> <tr> <td>Pet Type</td> <td> <select name="PetType"> <option value="0">Please select</option> <option value="Cat">Cat</option> <option value="Dog">Dog</option> <span class="error">* Required</span> </td> </tr> <tr> <td>Dog Breed:</td> <td> <select name="Breed"> <option value="0">Please select</option> <option value="PitBull">Pit Bull</option> <option value="Lab">Lab</option> <option value="Chihuaua">Chihuaua</option> <option value="Terrier">Terrier</option> <option value="German Shepherd">German Shepherd</option> <option value="Other">Other</option> </select> <span class="error">* Required if dog selected as pet type.</span> </td> </tr> <tr> <td>Pet Name:</td> <td><input name="PetName" type="text" size="15"> <span class="error">* Required</span></span> </td> </tr> <tr> <td>Spayed/Neutered:</td> <td>Yes<input name="NeuteredOrSpayed" type="checkbox" value="1"> No<input name="NeuteredOrSpayed" type="checkbox" value="0"></td> </tr> <tr> <td>Pet's Birthday:</td> <td><input name="PetBirthday" type="text"></td> </tr> <tr> <td> <input type="submit" value="Submit" name="submit"</input> </td> </tr> </tbody> </table> </form> </body> <hr> <footer> <?php require 'footer.php'; ?> </div> </footer> </body> </html>
  6. Thank you QuickOldCar, that worked! Now on to my next problem, this site has been a God-send, I have three days to finish this assignment and I am starting to panick a bit .
  7. Thank you for helping, that line does not appear in my php.ini file, do I need to add it, if so, does it go under mail function? I need manage to get rid of the error by changing the host to localhost, but now I am getting an SMTP error. In looking around I also found that SMTP is deactivated in XAMPP and I can find no instructions on how to activate it. Can anyone tell me how to activate it?
  8. I have created a contact form that sends an email when the user clicks the send button on the form. It acts like it is sending but then eventually times out with this message, "Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp-win32-1.8.3-5-VC11\xampp\htdocs\pet-shop\class.smtp.php on line 338". I have searched the forums and so far have not found any other posts on this. Can someone look at my php code and tell me if they see anything wrong? I got the settings from the gmail example in the phpmailer folder. This is for a class assignment, here is my php code: <?php $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; // here we use the php mail function // to send an email to: // you@yourdomain.com mail( "aughinbaughtestemail@gmail.com", "Contact Us",$message, "From: $email" ); ?> <?php date_default_timezone_set('Etc/UTC'); require 'PHPMailerAutoLoad.php'; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->STMPDebug = 2; $mail->Debugoutput = 'html';; $mail->Host = "smtp.gmail.com"; $mail->Port = 587; $mail->SMTPSecure = 'tls'; $mail->SMTPAuth = true; $mail->Username = "aughinbaughtestemail@gmail.com"; $mail->Password = "******"; $mail->From = $email; $mail->setFrom('aughinbaughtestemail@gmail.com','First Last'); $mail->addReplyTo('aughinbaughtestemail@gmail.com', 'First Last'); $mail->AddAddress('aughinbaughtestemail@gmail.com', 'Andrea Aughinbaugh'); $mail->Subject = 'PHPMailer Gmail SMTP test'; $mail->AltBody = 'This is a plain-text message body'; $message = $_REQUEST['message'] ; $mail->Body = $message; $mail->AltBody = $message; if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; ?> Thanks for all the help I have been receiving with this project, I know I must look like a bit of a dummy. I just noticed in the bottom left corner it says "waiting for localhost", don't know if that helps.
  9. Ok, thank you, looks like back to the drawing board on this.
  10. Thanks Psycho, This is for a class assignment, so dog and cat will be the only options. I checked out both of your links and have made partial progress. I changed the first dropdown(cat, dog) to checkboxes, and now I can get the select dropdown(Breed) to hide, but when I select the dog checkbox, it is not being displayed. Can you look at my code and tell me what I did incorrectly? Thanks, <tr> <td>Pet Type:</td> <td> <input type="checkbox" name="cat" id="cat">Cat <input type="checkbox" name="dog" id="dog">Dog </td> </tr> <tr> <td>Dog Breed:</td> <td> <script type="text/javascript"> function showHide() { var checkbox = document.getElementById("dog"); var hiddeninputs = document.getElemenetByClassName("hidden"); for (var i = 0; i! = hiddeninputs.length; i++) { if (checkbox.checked) { hiddeninputs[i].style.display = "block"; } else { hiddeninputs[i].style.display = "none"; } } } </script> </td> <select name="Breed"> <option value="0">Please select</option> <option value="PitBull">Pit Bull</option> <option value="Lab">Lab</option> <option value="Chihuaua">Chihuaua</option> <option value="Terrier">Terrier</option> <option value="German Shepherd">German Shepherd</option> <option value="Other">Other</option> </select> I did create a class called hidden where I set the display to none.
  11. I have an HTML form with a couple dropdown lists, What I am wanting to do is if "Dog" is selected from the first list, then the second list would be displayed. Right now both lists are displayed. The entire form is being submitted to a MySql database(just in case this is important). I am not sure how to go about this, I'm assuming I will need some kind of an if statement? Can someone give me some guidelines for my coding? Is this done with html or php, etc? Here is the portion of the form that contains the dropdown lists: <tr> <td>Pet Type</td> <td> <select name="PetType"> <option value="0">Please select</option> <option value="Cat">Cat</option> <option value="Dog">Dog</option> <span class="error">* Required</span> </td> </tr> <tr> <td>Dog Breed:</td> <td> <select name="Breed"> <option value="0">Please select</option> <option value="PitBull">Pit Bull</option> <option value="Lab">Lab</option> <option value="Chihuaua">Chihuaua</option> <option value="Terrier">Terrier</option> <option value="German Shepherd">German Shepherd</option> <option value="Other">Other</option> </select> Thanks for any help.
  12. IAmCrazyD, Thank you, that worked! I have been fighting with this for two weeks. Now onto the next step
  13. I am trying to complete a class assignment of building a website, pretty much a final project, and I am having an issue with one of my pages. I created a form that a user fills out and submits to a mysql database. My issue is that it is adding a row to the database, but it is unpopulated. I will be the first to admit that I'm not sure what I am doing, and was wondering if someone could look at my code and tell me where I am going wrong. I've googled this issue and tried all the fixes that were posted but nogo. Thanks in advance for any help. Here is the code for my php script: <?php $link = mysqli_connect('localhost', '****', '******', 'pet_shop'); if($link === false) { die("ERROR: Could not connect. " . mysqli_connect_error()); } error_reporting(E_ALL ^ E_NOTICE); $firstname = isset($link, $_POST['FirstName'])? $_POST['$firstame'] : ''; $lastname = isset($link, $_POST['LastName'])? $_POST['$LastName'] : ''; $address = isset($link, $_POST['Address'])? $_POST['$Address'] : ''; $city = isset($link, $_POST['City'])? $_POST['$City'] : ''; $state = isset($link, $_POST['State'])? $_POST['$State'] : ''; $zip = isset($link, $_POST['Zip'])? $_POST['$Zip'] : ''; $phonenumber = isset($link, $_POST['PhoneNumber'])? $_POST['$PhoneNumber'] : ''; $email = isset($link, $_POST['Email'])? $_POST['$Email'] : ''; $pettype = isset($link, $_POST['PetType'])? $_POST['$PetType'] : ''; $breed = isset($link, $_POST['Breed'])? $_POST['$Breed'] : ''; $petname = isset($link, $_POST['PetName'])? $_POST['$PetName'] : ''; $neuteredorspayed = isset($link, $_POST['NeuteredOrSpayed'])? $_POST['$NeuteredOrSpayed'] : ''; $petbirthday = isset($link, $_POST['PetBirthday'])? $_POST['$PetBirthday'] : ''; $sql = "INSERT INTO `pet_shop`.`grooming` (`FirstName`, `LastName`, `Address`, `City`, `State`, `Zip`, `PhoneNumber`, `Email`, `PetType`, `Breed`, `PetName`, `NeuteredOrSpayed`, `PetBirthday`) VALUES ('$firstname', '$lastname', '$address', '$city', '$state', '$zip', '$phonenumber', '$email', '$pettype', '$breed', '$petname', '$neuteredorspayed', '$petbirthday');"; if(mysqli_query($link, $sql)) { echo "A member of our staff will contact you to set up an appointment.."; } else { echo "ERROR: Could not execute $sql. " . mysqli_error($link); } mysqli_close($link); ?>
  14. Hi all, They say you should never stop learning to keep your mind sharp. I am learning how to write code at the age of 58, and I am finding that I don't learn as quickly as I used to. I am sure I will be asking a lot of questions as I go. I am currently in school, scheduled to be done by the end of this month. Pleased to meet you all, and I hope you don't mind an old newbie hanging around. VTXmom
×
×
  • 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.