Jump to content

mindapolis

Members
  • Posts

    361
  • Joined

  • Last visited

Everything posted by mindapolis

  1. okay, I have changed those things, but I'm stlil not getting a email after I submit the form. <?php //ini_set('display_errors', 'On'); //error_reporting(E_ALL); require_once('functions.php'); function outputErrors($sql_errors) { foreach($sql_errors as $name => $msgs) { echo('<h4 class="error">' . $name . ': ' . $msgs . '</h4>' . PHP_EOL); } } if(isset($_POST['submit'])) { /* Validate_input(); if(count($errors) != 0) { display_form(); } else { display_form(); } function validate_input() { global $errors; if($_POST['fname'] == "") { $errors['fname']="<font color='red'> Please enter your name</font>" } }*/ $sql_errors = array(); $mysqli = databaseConnection(); if(!$stmt = $mysqli->prepare("INSERT INTO clients(fname, lname, orgName, address, city, state, zipcode, phone, fax, email, confirmEmail, projectOptions, projectOverview, year) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { $sql_errors["Prepare"] = $mysqli->error . PHP_EOL; } else { if(!$stmt->bind_param('ssssssiiissisi', $_POST["fname"], $_POST["lname"], $_POST["orgName"], $_POST["address"], $_POST["city"], $_POST["state"], $_POST["zipcode"], $_POST["phone"], $_POST["fax"], $_POST["email"], $_POST["confirmEmail"], $_POST["projectOptions"], $_POST["projectOverview"], $_POST["year"])) { $sql_errors["bind_param"] = $stmt->error . PHP_EOL; } else { if(!$stmt->execute()) { $sql_errors["execute"] = $stmt->error . PHP_EOL; } $stmt->close(); } } $mysqli->close(); } if($_POST['submit']){ $admin = "[email protected]"; $subject = "inquiry about Media Services Unlimited"; //add variables from form if(mail($admin, $subject)){ echo "thank you"; exit; } else { echo "<h4>Error - Recovery Error</h4> <p>There was an error sending a recovery password. If the problem persists, please contact us directly.</p>"; header('mailForm.php');//change to contactUs.php when testing is done } } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Untitled Document</title>l <style type="text/css"> .error { color: #FF0000; } </style> </head> <body> <?php if(isset($sql_errors) && sizeof($sql_errors) > 0) outputErrors($sql_errors);?> <form action="thankYou.php" method="post"> <label> <input id="fname" type="text" name="fname" size="15" placeholder="First Name" value ="<?php echo isset($_POST['fname']) ? $_POST['fname'] : '';?>" > <input type="text" name="lname" size="20" placeholder="Last Name"><?php echo !empty($error['lname']) ? $error['lname'] : '';?> <input type="text" name="orgName" placeholder="Organization's Name"maxlength="50"> </label><br /> <label> <!--new row --> <input id="address" type="text" name="address" size="15" placeholder="Street Addresss" maxlength="50"> <input id="city" type="text" name="city" placeholder="City" size="10" maxlength="25"> <select id="state" name="state" placeholder="State" value=""> <option value ="">Please choose a state</option> <?php states($state); ?> </select> <input id = "zipcode" type="number" name="zipcode" placeholder="Zip Code" size="5" maxlength="5"> </label><br /> <label> <!--new row --> <input type="text" name="phone" placeholder="Phone Number:(including area code)" size="10" maxlength="10"> <input type="text" name="fax" size="10" placeholder="Fax Number: (including area code)" maxlength="10"> </label><br /> <label> <!--new row--> <input type="text" id = "email" name="email" placeholder="Email Address" /> <input type="text" id = "confirmEmail" name="confirmEmail" placeholder="Confirm Email Address" /> </label><br /> <label> <!--new row --> What would you like help with? <table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media</td> <td><input type="checkbox" name="WebContentManagement">Web Content Management</td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation</td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization)</td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing</td> <td><input type="checkbox" name="WebDesign">Web Design</td> </tr> </table> </label> Overview about the project:<textarea rows="5" cols="10" placeholder="Overview of Project"></textarea><br /> If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br /> <input type="submit" name="submit" value="Contact Me!"> <input type="reset" name="reset" value="Cancel"> </form> </body> </html>
  2. I changed the header temporarily but now I'm getting this error Parse error: syntax error, unexpected $end in /web/html/mediaservicesunlimited.com/test/mailForm.php on line 128 if(mail($admin, $subject, $message)){ echo "thank you"; exit; } else { $error_message = "<h4>Error - Recovery Error</h4> <p>There was an error sending a recovery password. If the problem persists, please contact us directly.</p>"; }
  3. hi, I'm trying to send a email after filing out a form. I'm not getting any error messages, but I'm not getting any emails either. Any help would be appreciated. <?php //ini_set('display_errors', 'On'); //error_reporting(E_ALL); require_once('functions.php'); function outputErrors($sql_errors) { foreach($sql_errors as $name => $msgs) { echo('<h4 class="error">' . $name . ': ' . $msgs . '</h4>' . PHP_EOL); } } if(isset($_POST['submit'])) { /* Validate_input(); if(count($errors) != 0) { display_form(); } else { display_form(); } function validate_input() { global $errors; if($_POST['fname'] == "") { $errors['fname']="<font color='red'> Please enter your name</font>" } }*/ $sql_errors = array(); $mysqli = databaseConnection(); if(!$stmt = $mysqli->prepare("INSERT INTO clients(fname, lname, orgName, address, city, state, zipcode, phone, fax, email, confirmEmail, projectOptions, projectOverview, year) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { $sql_errors["Prepare"] = $mysqli->error . PHP_EOL; } else { if(!$stmt->bind_param('ssssssiiissisi', $_POST["fname"], $_POST["lname"], $_POST["orgName"], $_POST["address"], $_POST["city"], $_POST["state"], $_POST["zipcode"], $_POST["phone"], $_POST["fax"], $_POST["email"], $_POST["confirmEmail"], $_POST["projectOptions"], $_POST["projectOverview"], $_POST["year"])) { $sql_errors["bind_param"] = $stmt->error . PHP_EOL; } else { if(!$stmt->execute()) { $sql_errors["execute"] = $stmt->error . PHP_EOL; } $stmt->close(); } } $mysqli->close(); header('contactTest.php'); } if($_POST['submit']){ $admin = "[email protected]"; $subject = "inquiry about Media Services Unlimited"; //add variables from form //send email mail($admin, $subject, $message); //email response echo "thank you"; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Untitled Document</title>l <style type="text/css"> .error { color: #FF0000; } </style> </head> <body> <?php if(isset($sql_errors) && sizeof($sql_errors) > 0) outputErrors($sql_errors);?> <form action="thankYou.php" method="post"> <label> <input id="fname" type="text" name="fname" size="15" placeholder="First Name" value ="<?php echo isset($_POST['fname']) ? $_POST['fname'] : '';?>" > <input type="text" name="lname" size="20" placeholder="Last Name"><?php echo !empty($error['lname']) ? $error['lname'] : '';?> <input type="text" name="orgName" placeholder="Organization's Name"maxlength="50"> </label><br /> <label> <!--new row --> <input id="address" type="text" name="address" size="15" placeholder="Street Addresss" maxlength="50"> <input id="city" type="text" name="city" placeholder="City" size="10" maxlength="25"> <select id="state" name="state" placeholder="State" value=""> <option value ="">Please choose a state</option> <?php states($state); ?> </select> <input id = "zipcode" type="number" name="zipcode" placeholder="Zip Code" size="5" maxlength="5"> </label><br /> <label> <!--new row --> <input type="text" name="phone" placeholder="Phone Number:(including area code)" size="10" maxlength="10"> <input type="text" name="fax" size="10" placeholder="Fax Number: (including area code)" maxlength="10"> </label><br /> <label> <!--new row--> <input type="text" id = "email" name="email" placeholder="Email Address" /> <input type="text" id = "confirmEmail" name="confirmEmail" placeholder="Confirm Email Address" /> </label><br /> <label> <!--new row --> What would you like help with? <table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media</td> <td><input type="checkbox" name="WebContentManagement">Web Content Management</td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation</td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization)</td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing</td> <td><input type="checkbox" name="WebDesign">Web Design</td> </tr> </table> </label> Overview about the project:<textarea rows="5" cols="10" placeholder="Overview of Project"></textarea><br /> If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br /> <input type="submit" name="submit" value="Contact Me!"> <input type="reset" name="reset" value="Cancel"> </form> </body> </html>
  4. I'm so sorry. I'm brand new to PDO. I will work on it tonight. Thanks so much for being nice about it.
  5. I am so sorry for all the questions. Once I understand how to get the form data into the database I should not have as many questions. could someone help me understand why I'm getting this error message? Fatal error: Call to a member function prepare() on a non-object in /web/html/mediaservicesunlimited.com/contactTest.php on line 10 Supposedly it 's with my database connection, but i have done tests and I can connect with the database just fine. functions.php //database connection function databaseConnection() { $hostname = "hercules.xymmetrix.net"; $username = "d"; $password = "s"; //the log in information is in the file try { $db = new PDO("mysql:host=$hostname;dbname=www_mediaservicesunlimited_com", $username, $password); } catch(PDOException $e) { echo $e->getMessage(); } } <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Untitled Document</title> <?php require_once('functions.php'); if(isset($_POST['submit'])) { databaseConnection(); $stmt = $mysqli ->prepare("INSERT INTO clients (fname, lname, orgName, address, city, state, zipcode, phone, fax, email, confirmEmail, projectOptions, projectOverview, year) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt -> bind_param('sssssssssssssi', $_POST[fname], $_POST[lname], $_POST[orgName], $_POST[address], $_POST[city], $_POST[state], $_POST[zipcode], $_POST[phone], $_POST[fax], $_POST[email], $_POST[confirmEmail], $_POST[projectOptions], $_POST[projectOverview], $_POST[year]); $stmt -> execute(); $stmt -> close(); } ?> </head> <body> <form action ="contactTest.php" method="post"> <label> <input id = "fname" type="text" name="fname" size="15" placeholder="First Name" value ="<?php echo !empty($_POST['fname']) ? $_POST['fname'] : '';?>" > <?php echo !empty($error['fname']) ? $error['fname'] : '';?> <input type="text" name="lname" size="20" placeholder="Last Name"><?php echo !empty($error['lname']) ? $error['lname'] : '';?> <input type="text" name="orgName" placeholder="Organization's Name"maxlength="50"> </label><br /> <label> <!--new row --> <input id = "address" type="text" name="address" size="15" placeholder="Street Addresss" maxlength="50"> <input id = "city" type="text" name="city" placeholder="City" size="10" maxlength="25"> <select id = "state" name = "state" placeholder="State" value=""> <option value ="Please choose a state"> Please choose a state </option> <?php states($state); ?> </select> <input id = "zipcode" type="number" name="zipcode" placeholder="Zip Code" size="5" maxlength="5"> </label><br /> <label> <!--new row --> <input type="text" name="phone" placeholder="Phone Number:(including area code)" size="10" maxlength="10"> </label> <input type="text" name="fax" size="10" placeholder="Fax Number: (including area code)" maxlength="10"> </label><br /> <label> <!--new row--> <input type="text" id = "email" name="email" placeholder="Email Address" /> <input type="text" id = "confirmEmail" name="ConfirmEmail" placeholder="Confirm Email Address" /> </label><br /> <label> <!--new row --> What would you like help with? <table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media </td> <td><input type="checkbox" name="WebContentManagement">Web Content Management </td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation </td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization) </td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing </td> <td><input type="checkbox" name="WebDesign">Web Design </td> </tr> </table> </label> Overview about the project:<textarea rows="5" cols="10" placeholder="Overview of Project"></textarea><br /> If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br /> <input type="submit" name="submit" value="Contact Me!"> <input type="reset" name="reset" value="Cancel"> </form> </body> </html>
  6. Right now I'm just trying to figure out why I'm getting this error message. Parse error: syntax error, unexpected T_VARIABLE in /web/html/mediaservicesunlimited.com/contactTest.php on line 13 <?php require_once('functions.php'); databaseConnection(); /*if(isset($_POST['submit'])) { } */ $stmt = $mysqli ->prepare("INSERT INTO clients fname,lname,orgName,address,city,state,zipcode,phone,fax,email,confirmEmail,projectOptions,projectOverview,year) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)" $stmt -> bind_param('sssssssssssssi', $_POST[fname],$_POST[lname],$_POST[orgName],$_POST[address],$_POST[city],$_POST[state],$_POST[zipcode],$_POST[phone],$_POST[fax],$_POST[email],$_POST[confirmEmail], $_POST[projectOptions],$_POST[projectOverview],$_POST[year] ); $stmt -> execute(); $stmt -> close(); ?>
  7. Hi, can someone please help me understand why I'm getting this error Parse error: syntax error, unexpected ';' in /web/html/mediaservicesunlimited.com/contactTest.php on line 12 <?php require_once('functions.php'); databaseConnection(); /*if(isset($_POST['submit'])) { } */ $stmt = $mysqli ->prepare("INSERT INTO clients fname,lname,orgName,address,city,state,zipcode,phone,fax,email,confirmEmail,projectOptions,projectOverview,year) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; $stmt -> bind_param('sssssssssssssi', $_POST[fname],$_POST[lname],$_POST[orgName],$_POST[address],$_POST[city],$_POST[state],$_POST[zipcode],$_POST[phone],$_POST[fax],$_POST[email],$_POST[confirmEmail], $_POST[projectOptions],$_POST[projectOverview],$_POST[year] ); $stmt -> execute(); $stmt -> close(); ?>
  8. Thanks. That is so helpful, not!
  9. I did. I'm not understanding.
  10. Do you put question marks for every variable going into the database table
  11. I'm sorry, but I'm not following that at all.
  12. Ok, I think I'm getting closer, but I don't understand what to put in this section VALUES (?,?,NOW(),?,?)'); $stmt -> bind_param('ssi', that's from the code below $stmt = $mysqli -> prepare('INSERT INTO clients fname,lname,orgName,address,city,state,zipcode,phone,fax,email,confirmEmail,projectOptions,projectOverview,year); VALUES (?,?,NOW(),?,?)'); $stmt -> bind_param('ssi', VALUES ('$_POST[fname]','$_POST[lname]','$_POST[orgName]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zipcode]','$_POST[phone]','$_POST[fax]','$_POST[email]','$_POST[confirmEmail]','$_POST[projectOptions]','$_POST[projectOverview]','$_POST[year]' ); $stmt -> execute(); $stmt -> close();
  13. Got it fixed !
  14. I'm sorry I got confused. The hostname is hercules.xymmetrix.net and the database name is www_media_services_unlimited but I'm getting get the same error. SQLSTATE[42000] [1044] Access denied for user 'mediasvcunltd'@'monolith.xymmetrix.net' to database ' www_mediaservicesunlimited_com' $hostname = "hercules.xymmetrix.net"; $username = ""; $password = ""; try { $db = new PDO("mysql:host=$hostname;dbname= www_mediaservicesunlimited_com", $username, $password); echo 'Connected to database'; } catch(PDOException $e) { echo $e->getMessage(); }
  15. then why be am I getting that error on http://mediaservicesunlimited.com/contactTest.php the database name is hercules.xymmetrix.net. Would that make a difference?
  16. <?php require_once('functions.php'); $hostname = "hercules.xymmetrix.net"; $username = "..."; $password = "..."; try { $db = new PDO("mysql:host=$hostname;dbname=hercules.xymmetrix.net", $username, $password); echo 'Connected to database'; } catch(PDOException $e) { echo $e->getMessage(); } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <form action ="contactUs.php" method="post"> <label> <input id = "fname" type="text" name="fname" size="15" placeholder="First Name" value ="<?php echo !empty($_POST['fname']) ? $_POST['fname'] : '';?>" > <?php echo !empty($error['fname']) ? $error['fname'] : '';?> <input type="text" name="lname" size="20" placeholder="Last Name"><?php echo !empty($error['lname']) ? $error['lname'] : '';?> <input type="text" name="orgName" placeholder="Organization's Name"maxlength="50"> </label><br /> <label> <!--new row --> <input id = "address" type="text" name="address" size="15" placeholder="Street Addresss" maxlength="50"> <input id = "city" type="text" name="city" placeholder="City" size="10" maxlength="25"> <select id = "state" name = "state" placeholder="State" value=""> <option value ="Please choose a state"> Please choose a state </option> <?php states($state); ?> </select> <input id = "zipcode" type="number" name="zipcode" placeholder="Zip Code" size="5" maxlength="5"> </label><br /> <label> <!--new row --> <input type="text" name="phone" placeholder="Phone Number:(including area code)" size="10" maxlength="10"> </label> <input type="text" name="fax" size="10" placeholder="Fax Number: (including area code)" maxlength="10"> </label><br /> <label> <!--new row--> <input type="text" id = "email" name="email" placeholder="Email Address" /> <input type="text" id = "confirmEmail" name="ConfirmEmail" placeholder="Confirm Email Address" /> </label><br /> <label> <!--new row --> What would you like help with? <table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media </td> <td><input type="checkbox" name="WebContentManagement">Web Content Management </td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation </td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization) </td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing </td> <td><input type="checkbox" name="WebDesign">Web Design </td> </tr> </table> </label> Overview about the project:<textarea rows="5" cols="10" placeholder="Overview of Project"></textarea> <br /> If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br /> <input type="submit" name="submit" value="Contact Me!"> <input type="reset" name="reset" value="Cancel"> </form> </body> </html>
  17. I changed the database name $db = new PDO("mysql:host=$hostname;dbname=hercules.xymmetrix.net", $username, $password); but it say SQLSTATE[42000] [1044] Access denied for user 'mediasvcunltd'@'monolith.xymmetrix.net' to database 'hercules.xymmetrix.net'
  18. That's strange. I can connect to it with the old PHP code. Oh wait, is this line of code correct? $db = new PDO("mysql:host=$hostname;dbname=mysql", $username, $password); Yes, i did declare the variables beforehand.
  19. Hi, I'm new to PDO. Can someone tell me what this error message means? SQLSTATE[42000] [1044] Access denied for user 'mediasvcunltd'@'monolith.xymmetrix.net' to database 'mysql'
  20. Hi, why is it giving me this error Notice: Undefined variable: year in /web/html/mediaservicesunlimited.com/contactUs.php on line 49 but I did define year on line 39 <?php require_once('functions.php'); databaseConnection(); error_reporting(-1); ini_set('display_errors', 1); if ($_POST) { $error = array(); if (empty($_POST['fname'])) { $error['fname'] = "<span class='error'>Please enter your first name.</span>"; } if (empty($_POST['lname'])) { $error['lname'] = "<span class='error'>Please enter your last name.</span>"; } if (!count($error)) { //Do something die("Do Something here"); } if(isset($_POST['submit'])) { $fname = $_POST['fname']; $lname = $_POST['lname']; $orgName = $_POST['orgName']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zipcode = $_POST['zipcode']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $confirmEmail = $_POST['confirmEmail']; $projectOptions = $_POST['projectOptions']; $projectOverview = $_POST['projectOverview']; $year = $_POST['year']; $services=array('social media', 'web content management', 'marketing material creation', 'SEO', 'video editing' , 'web design'); } mysql_select_db("www_mediaservicesunlimited_com"); $sql="INSERT INTO clients (fname,lname,orgName,address,city,state,zipcode,phone,fax,email,confirmEmail,projectOptions,projectOverview,year) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[orgName]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zipcode]','$_POST[phone]','$_POST[fax]','$_POST[email]','$_POST[confirmEmail]','$_POST[projectOptions]','$_POST[projectOverview]','$_POST[year]' )"; } ///mysql_query($sql,$databaseConnection); ///mysql_close($databaseConnection); if ($year !="2015") { print "Please enter the current year"; } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <style type="text/css"> #contactForm label, #contactForm input { margin-bottom:20px; } </style> <title>Untitled Document</title> </head> <body> <div id="contactForm"> <form action ="contactUs.php" method="post"> <label> <label for "fname"> First Name:</label> <input id = "fname" type="text" name="fname" size="15" value ="<?php echo !empty($_POST['fname']) ? $_POST['fname'] : '';?>" > <?php echo !empty($error['fname']) ? $error['fname'] : '';?> <label for "lname">Last Name:</label> <input type="text" name="lname" size="20"><?php echo !empty($error['lname']) ? $error['lname'] : '';?> <label for="orgName">Organization's Name:</label> <input type="text" name="orgName" maxlength="50"> </label><br /> <label> <!--new row --> <label for "address">Street Address: </label> <input id = "address" type="text" name="address" size="15" maxlength="50"> <label id="city">City: </label> <input id = "city" type="text" name="city" size="10" maxlength="25"> <label for "state"> State: </label> <select id = "state" name = "state" value=""> <option value ="Please choose a state"> Please choose a state </option> <?php states($state); ?> </select> <label for "zipcode">Zipcode:</label> <input id = "zipcode" type="number" name="zipcode" size="5" maxlength="5"> </label><br /> <label> <!--new row --> <label for "phone"> Phone Number:(including area code) <br /> </label> <input type="text" name="phone" size="10" maxlength="10"> <label for="fax">Fax Number: (including area code) </label> <input type="text" name="fax" size="10" maxlength="10"> </label><br /> <label> <!--new row--> <label for="email">Email: </label> <input type="text" id = "email" name="email" /> <label for="confirmEmail"> Confirm Email:</label> <input type="text" id = "confirmEmail" name="ConfirmEmail" /> </label><br /> <label> <!--new row --> <label for "projectChoices"> What would you like help with? <br /></label> <table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media </td> <td><input type="checkbox" name="WebContentManagement">Web Content Management </td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation </td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization) </td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing </td> <td><input type="checkbox" name="WebDesign">Web Design </td> </tr> </table> <label for="projectOverview"> Overview about the project:</label><textarea rows="5" cols="10"></textarea> <br /> If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br /> <input type="submit" name="submit" value="Contact Me!"> <input type="reset"> </form> </div> </body> </html>
  21. I finally got it, thank you for all the help.
  22. I added the isset function to see if the form was submitted, but that didn't help. if I could get a little more help that would be much appreciated. <?php require_once('functions.php'); databaseConnection(); error_reporting(-1); ini_set('display_errors', 1); if ($_POST) { $error = array(); if (empty($_POST['fname'])) { $error['fname'] = "<span class='error'>Please enter your first name.</span>"; } if (empty($_POST['lname'])) { $error['lname'] = "<span class='error'>Please enter your last name.</span>"; } if (!count($error)) { //Do something die("Do Something here"); } } if(isset($_POST['submit'])) { $fname = $_POST['fname']; $lname = $_POST['lname']; $orgName = $_POST['orgName']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zipcode = $_POST['zipcode']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $confirmEmail = $_POST['confirmEmail']; $projectOptions = $_POST['projectOptions']; $projectOverview = $_POST['projectOverview']; $year = $_POST['year']; $services=array('social media', 'web content management', 'marketing material creation', 'SEO', 'video editing' , 'web design'); } mysql_select_db("www_mediaservicesunlimited_com"); mysql_query("INSERT INTO clients (fname, lname, orgName, address, city, state, zipcode, phone, fax, email, confirmEmail, projectOptions, projectOverview, year)", "VALUES ('$fname', '$lname', '$orgName', '$address', '$city', '$state', $zipcode', '$phone', '$fax', '$email', '$confirmEmail', '$projectOptions', '$projectOverview', '$year' )" ); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <style type="text/css"> #contactForm label, #contactForm input { margin-bottom:20px; } </style> <title>Untitled Document</title> </head> <body> <div id="contactForm"> <form method="post"> <label> <label for "fname"> First Name:</label> <input id = "fname" type="text" name="fname" size="15" value ="<?php echo !empty($_POST['fname']) ? $_POST['fname'] : '';?>" > <?php echo !empty($error['fname']) ? $error['fname'] : '';?> <label for "lname">Last Name:</label> <input type="text" name="lname" size="20"><?php echo !empty($error['lname']) ? $error['lname'] : '';?> <label for="orgName">Organization's Name:</label> <input type="text" name="orgName" maxlength="50"> </label><br /> <label> <!--new row --> <label for "address">Street Address: </label> <input id = "address" type="text" name="address" size="15" maxlength="50"> <label id="city">City: </label> <input id = "city" type="text" name="city" size="10" maxlength="25"> <label for "state"> State: </label> <select id = "state" name = "state" value=""> <option value ="Please choose a state"> Please choose a state </option> <?php states($state); ?> </select> <label for "zipcode">Zipcode:</label> <input id = "zipcode" type="number" name="zipcode" size="5" maxlength="5"> </label><br /> <label> <!--new row --> <label for "phone"> Phone Number:(including area code) <br /> </label> <input type="text" name="phone" size="10" maxlength="10"> <label for="fax">Fax Number: (including area code) </label> <input type="text" name="fax" size="10" maxlength="10"> </label><br /> <label> <!--new row--> <label for="email">Email: </label> <input type="text" id = "email" name="email" /> <label for="confirmEmail"> Confirm Email:</label> <input type="text" id = "confirmEmail" name="ConfirmEmail" /> </label><br /> <label> <!--new row --> <label for "projectChoices"> What would you like help with? <br /></label> <table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media </td> <td><input type="checkbox" name="WebContentManagement">Web Content Management </td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation </td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization) </td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing </td> <td><input type="checkbox" name="WebDesign">Web Design </td> </tr> </table> <label for="projectOverview"> Overview about the project:</label><textarea rows="5" cols="10"></textarea> <br /> If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br /> <input type="submit" name="submit" value="Contact Me!"> <input type="reset"> </form> </div> </body> </html>
  23. Actually let me work on it tomorrow
  24. I'm sorry, could you explain a little more?
  25. What does this error mean? Notice: Undefined index: fname in /web/html/mediaservicesunlimited.com/contactUs.php on line 26 Should the php code go after the html ? <?php require_once('functions.php'); databaseConnection(); error_reporting(-1); ini_set('display_errors', 1); if ($_POST) { $error = array(); if (empty($_POST['fname'])) { $error['fname'] = "<span class='error'>Please enter your first name.</span>"; } if (empty($_POST['lname'])) { $error['lname'] = "<span class='error'>Please enter your last name.</span>"; } if (!count($error)) { //Do something die("Do Something here"); } } $fname = $_POST['fname']; $lname = $_POST['lname']; $orgName = $_POST['orgName']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zipcode = $_POST['zipcode']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $confirmEmail = $_POST['confirmEmail']; $projectOptions = $_POST['projectOptions']; $projectOverview = $_POST['projectOverview']; $year = $_POST['year']; $services=array('social media', 'web content management', 'marketing material creation', 'SEO', 'video editing' , 'web design'); mysql_select_db("www_mediaservicesunlimited_com"); mysql_query("INSERT INTO clients (fname, lname, orgName, address, city, state, zipcode, phone, fax, email, confirmEmail, projectOptions, projectOverview, year)", "VALUES ('$fname', '$lname', '$orgName', '$address', '$city', '$state', $zipcode', '$phone', '$fax', '$email', '$confirmEmail', '$projectOptions', '$projectOverview', '$year' )" ); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <style type="text/css"> #contactForm label, #contactForm input { margin-bottom:20px; } </style> <title>Untitled Document</title> </head> <body> <div id="contactForm"> <form method="post"> <label> <label for "fname"> First Name:</label> <input id = "fname" type="text" name="fname" size="15" value ="<?php echo !empty($_POST['fname']) ? $_POST['fname'] : '';?>" > <?php echo !empty($error['fname']) ? $error['fname'] : '';?> <label for "lname">Last Name:</label> <input type="text" name="lname" size="20"><?php echo !empty($error['lname']) ? $error['lname'] : '';?> <label for="orgName">Organization's Name:</label> <input type="text" name="orgName" maxlength="50"> </label><br /> <label> <!--new row --> <label for "address">Street Address: </label> <input id = "address" type="text" name="address" size="15" maxlength="50"> <label id="city">City: </label> <input id = "city" type="text" name="city" size="10" maxlength="25"> <label for "state"> State: </label> <select id = "state" name = "state" value=""> <option value ="Please choose a state"> Please choose a state </option> <?php states($state); ?> </select> <label for "zipcode">Zipcode:</label> <input id = "zipcode" type="number" name="zipcode" size="5" maxlength="5"> </label><br /> <label> <!--new row --> <label for "phone"> Phone Number:(including area code) <br /> </label> <input type="text" name="phone" size="10" maxlength="10"> <label for="fax">Fax Number: (including area code) </label> <input type="text" name="fax" size="10" maxlength="10"> </label><br /> <label> <!--new row--> <label for="email">Email: </label> <input type="text" id = "email" name="email" /> <label for="confirmEmail"> Confirm Email:</label> <input type="text" id = "confirmEmail" name="ConfirmEmail" /> </label><br /> <label> <!--new row --> <label for "projectChoices"> What would you like help with? <br /></label> <table id="projectOptions"> <tr span=2> <td><input type="checkbox" name="SocialMedia">Social Media </td> <td><input type="checkbox" name="WebContentManagement">Web Content Management </td> </tr> <tr> <td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation </td> <td><input type="checkbox" name="SEO">SEO (Search Engine Optimization) </td> </tr> <tr> <td><input type="checkbox" name="VideoEditing"> Video Editing </td> <td><input type="checkbox" name="WebDesign">Web Design </td> </tr> </table> <label for="projectOverview"> Overview about the project:</label><textarea rows="5" cols="10"></textarea> <br /> If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br /> <input type="submit" name="submit" value="Contact Me!"> <input type="reset"> </form> </div> </body> </html>
×
×
  • 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.