Jump to content

help1990

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by help1990

  1. I am trying to build a customer form which will submit information to a mysql table using simple PHP and html. I've tried for hours with no luck. I'm really stumped on what I'm doing wrong. I am not getting any errors back which is a step up before but I am not seeing my updates to my table in mysql. I am a beginner in PHP so my code definitely needs work. Any advice would be greatly appreciated. here is my html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Grooming Appointment</title> </head> <body> <form action="submit.php" method="post"> <p> <label for="FirstName">First Name:</label> <input type="text" name="Firstname" id="FirstName"> </p> <p> <label for="LastName">Last Name:</label> <input type="text" name="LastName" id="LastName"> </p> <p> <label for="Address">Address:</label> <input type="text" name="Address" id="Address"> </p> <p> <label for="City">City:</label> <input type="City" name="City" id="City"> </p> <p> <label for="State">State:</label> <input type="State" name="State" id="State"> </p> <p> <label for="Zip">Zip:</label> <input type="Zip" name="Zip" id="Zip"> </p> <p> <label for="PhoneNumber">Phone Number:</label> <input type="PhoneNumber" name="PhoneNumber" id="PhoneNumber"> </p> <p> <label for="Email">Email:</label> <input type="Email" name="Email" id="Email"> </p> <p> <label for="PetType">Pet Type:</label> <input type="PetType" name="PetType" id="PetType"> </p> <p> <label for="Breed">Breed:</label> <input type="Breed" name="Breed" id="Breed"> </p> <p> <label for="PetName">PetName:</label> <input type="PetName" name="PetName" id="PetName"> </p> <p> <label for="NeuteredOrSpayed">Neutered or Spayed:</label> <input type="NeuteredOrSpayed" name="NeuteredOrSpayed" id="NeuteredOrSpayed"> </p> <p> <label for="PetBirthday">Pet Birthday:</label> <input type="PetBirthday" name="PetBirthday" id="PetBirthday"> </p> <input type="submit" id="Submit" action="submit.php" name="Submit"> </form> </form> </body> </html> and here is my php <?php $host=""; $port=3306; $socket=""; $user=""; $password=""; $dbname="pet_shop3"; $con = new mysqli($host, $user, $password, $dbname, $port, $socket) or die ('Could not connect to the database server' . mysqli_connect_error()); //$con->close(); if( isset( $_POST['submit'])){ $FirstName = $_POST['FirstName']; $LastName = $_POST['LastName']; $Address = $_POST['Address']; $City = $_POST['City']; $State = $_POST['State']; $Zip = $_POST['Zip']; $PhoneNumber = $_POST['PhoneNumber']; $Email = $_POST['Email']; $PetType = $_POST['PetType']; $Breed = $_POST['Breed']; $PetName = $_POST['PetName']; $NeuteredOrSpayed = $_POST['NeuteredOrSpayed']; $PetBirthday = $_POST['PetBirthday']; $con = "INSERT INTO `grooming` (`GroomingID`, `FirstName`, `LastName`, `Address`, `City`, `State`, `Zip`, `PhoneNumber`, `Email`, `PetType`, `Breed`, `PetName`, `NeuteredOrSpayed`, `PetBirthday`) VALUES ('$_POST[FirstName]','$_POST[LastName]','$_POST[Address]','$_POST[City]','$_POST[State]','$_POST[Zip]','$_POST[PhoneNumber]','$_POST[Email]','$_POST[PetType]','$_POST[City]','$_POST[Breed]','$_POST[PetName]','$_POST[NeuteredOrSpayed]','$_POST[PetBirthday]')"; } ?>
×
×
  • 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.