Jump to content

acarder488

Members
  • Posts

    20
  • Joined

  • Last visited

acarder488's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $sendEmail= $to = 'webmaster@ottawa-glandorfems.org'; $subject= 'Registration from $fname'; $fname= $_POST['fname']; $lname= $_POST['lname']; $email= $_POST['email']; $street_address= $_POST['$street_address']; $city= $_POST['city']; $state= $_POST['state']; $zip_code= $_POST['zip_code']; $phone= $_POST['phone']; $department= $_POST['department']; $level= $_POST['level']; $message=<<<EMAIL "My name is $fname . $lname , my email is $email . \r\n My address is $street_address . $city . , $state . $zip_code . \r\n My phone number is $phone . I work for $department and my level of training is $level . \r\n" EMAIL; $header = '$email'; mail($to, $subject, $message, $header); Ok I saw the Sheader issue. Is there something else I am missing? I also added the \r\n not sure if it is needed.
  2. Ok thanks!! Now I am getting no errors and it is going to my sql but I am still not receiving an email.
  3. I am trying to validate my form and then send a message back to the submitter and then send an email to me with the information the submitter inputed. <?php include_once("analyticstracking.php") ?> <?php include_once("analyticstracking1.php") ?> <?php include_once('init.php'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); }; if(isset($_POST['submit'])) { if (!$_POST['fname'] ) { $mes1='Please enter your First Name';} elseif (!$_POST['lname'] ) { $mes2='Please enter your Last Name';} elseif (!$_POST['street_address'] ) { $mes3='Please enter your Street Address';} elseif (!$_POST['city'] ) { $mes4='Please enter your City';} elseif (!$_POST['state'] ) { $mes5='Please enter your State';} elseif (!$_POST['zip_code'] ) { $mes6='Please enter your Zip Code';} elseif (!$_POST['phone'] ) { $mes7='Please enter your Phone Number';} elseif (!$_POST['department'] ) { $mes9='Please enter your Department';} elseif (!$_POST['email'] ) { $mes10='Please enter your Email Address';} elseif (!$_POST['level']) { $mes12='Please select a Level Of Training';} else { echo " Thank you $_POST[fname] !! Your registration has been submitted!!"; && $sendEmail; } } if(isset($_POST['submit'])) { // validate a phone number if(preg_match("/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/", $_POST['phone'])); // $phone is valid else echo $mes8= 'invalid phone number'; if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { // The email address is not valid echo $mes11= 'invalid email entered';}} $sendEmail= $to = ' webmaster@ottawa-glandorfems.org'; $subject= 'Regisration from $fname'; $fname= $_POST['fname']; $lname= $_POST['lname']; $email= $_POST['email']; $street_address= $_POST['$street_address']; $city= $_POST['city']; $state= $_POST['state']; $zip_code= $_POST['zip_code']; $phone= $_POST['phone']; $department= $_POST['department']; $level= $_POST['level']; $message=<<<EMAIL My name is $fname. $lname, my email is $email. My address is $stree_address . $city . , $state . $zip_code. My phone number is $phone. I work for $department and my level of training is $level. EMAIL; $header = '$email'; mail to($to, $subject, $message, $additional_headers); if (isset($_POST['fname'], $_POST['lname'], $_POST['phone'], $_POST['street_address'], $_POST['city'], $_POST['state'], $_POST['zip_code'], $_POST['department'], $_POST['email'], $_POST['level'])) { $fname = mysqli_real_escape_string ($conn, trim($_POST['fname'])); $lname = mysqli_real_escape_string ($conn, trim($_POST['lname'])); $phone = mysqli_real_escape_string ($conn, trim($_POST['phone'])); $street_address = mysqli_real_escape_string ($conn, trim($_POST['street_address'])); $city = mysqli_real_escape_string ($conn, trim($_POST['city'])); $state = mysqli_real_escape_string ($conn, trim($_POST['state'])); $zip_code = mysqli_real_escape_string ($conn, trim($_POST['zip_code'])); $department = mysqli_real_escape_string ($conn, trim($_POST['department'])); $email = mysqli_real_escape_string ($conn, trim($_POST['email'])); $level = mysqli_real_escape_string ($conn, trim($_POST['level'])); $query ="INSERT INTO oktoberfesttest2014 SET First_Name='{$fname}', Last_Name='{$lname}', Phone='{$phone}', Address='{$street_address}', City='{$city}', State='{$state}', Zip_Code='{$zip_code}', Department='{$department}', Email_Address='{$email}', Level_of_Training='{$level}'"; mysqli_query($conn, $query); //if (!mysqli_query($conn, $query)) { //printf("Errormessage: %s\n", mysqli_error($conn)); //}; } ?> <!DOCTYPE html> <html> <head> <title>Registration form for Octoberfest With O-G EMS 2013</title> </head> <body bgcolor="#084B8A"> <br><div align="center"><img id="Oktoberfest Logo" src="/pics/oktoberfestweb.jpg" border="5" height="200" width="250"><br><br><table style="background-color: beige; border: 1px dashed #999"><tr><td> <center><form action="" method="post"> <p><center>REGISTRATION FORM</center></p> First Name:<input type="text" name="fname" placeholder="First name" size="25" > <p> <b><?php echo "$mes1"; ?></b></p> <p>Last Name:<input type="text" name="lname" size="25" placeholder="Last Name" /> </p><p><b><?php echo "$mes2";?></b> </p> <p>Phone Number:<input type="text" name="phone" placeholder="Phone Number (xxx-xxx-xxxx)" size="30" /></p><p><b><?php echo "$mes7";?><?php echo "$mes8";?></b> </p> <p>Address:<input type="text" name="street_address" size="30" placeholder="Street Address (P.O. Box)" /><p><b><?php echo "$mes3";?></b> </p><input type="text" name="city" size="10" placeholder="City" /><p><b><?php echo "$mes4";?><b> </p><input type="text" placeholder="State" name="state" size="5" /><p><b><?php echo "$mes5";?></b> </p><input type="text" name="zip_code" size="10" placeholder="Zip Code" /><p><b><?php echo "$mes6";?></b> </p> <p>Department:<input type="text" name="department"size="25" placeholder="Department/Agency" /></p><p><b><?php echo "$mes9";?></b> </p> <p>Email Address:<input type="text" name="email" size="40" placeholder="Email Address" /></p></center><p><b><?php echo "$mes10"; ?><?php echo "$mes11";?></b> </p> <fieldset><legend><b>LEVEL OF TRAINING</b></legend> <p><b>(PLEASE NOTE IF YOU HAVE MULTIPLE LEVELS...<br>PLEASE CHOOSE THE ONE YOUR WILL BE ATTENDING FOR)</b></br><p><b><?php echo "$mes12";?></b> </p> <input type="radio" name="level" value="EMR">EMR</br> <input type="radio" name="level" value="EMT-B">EMT-B</br> <input type="radio" name="level" value="EMT-I">EMT-I</br> <input type="radio" name="level" value="EMT-P">EMT-P</br> <input type="radio" name="level" value="Nurse">Nurse</br></p></fieldset> <input type="submit" name="submit" value="Register"><td align="left" valign="bottom"></form><table><tr> <fieldset> <legend><b>If you are not a Putnam County Employee please pay HERE!</b></legend> <form action="https://www.paypal.com/cgi-bin/webscr" target ="_blank" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="V9XZ2NSAT5BWA"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form></tr> </table> </fieldset> </td> </form></td></tr></table> </body> </html> error given is on line 53...I have given my entire html/php for this page. Here is the error I receive.....Parse error: syntax error, unexpected T_BOOLEAN_AND in /home/a9035067/public_html/oktoberfestr12.php on line 53. Thanks for any help.
  4. yup cpd. I did and I have figured it out. I had been looking over the manual when I asked it again. I knew I was close and very close at that. Thank you again for your patience and help.
  5. Ok actually I am still getting : Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 6 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 13 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 14 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 15 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 16 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 17 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 18 Warning: mysqli_query() expects at least 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 32
  6. Thanks PFMaBiSmAd, I am still getting 1 error now and I have changed it to the "i". <?php include_once('init.php'); if (isset($_POST['fname'], $_POST['lname'], $_POST['phone'], $_POST['address'], $_POST['department'], $_POST['email'], $_POST['level'])) { $fname = mysqli_real_escape_string (htmlentities ($_POST['fname'])); $lname = mysqli_real_escape_string (htmlentities ($_POST['lname'])); $address = mysqli_real_escape_string (htmlentities ($_POST['address'])); $department = mysqli_real_escape_string (htmlentities ($_POST['departmenet'])); $email = mysqli_real_escape_string (htmlentities ($_POST['email'])); $level = mysqli_real_escape_string (htmlentities ($_POST['level'])); $query ="INSERT INTO Oktoberfest2013 SET 'First_Name'='{$fname}'; 'Last_Name'='{$lname}'; 'Phone'='{$phone}'; 'Address'='{$address}'; 'Department'='{$department}'; 'Email_Address'='{$email}'; 'Level_of_Training'='{$level}'"; mysqli_query($query); } ?> <html> <head> <title>Registration form for Octoberfest With O-G EMS 2013</title> </head> <body> <form action="" method="post"> <p Registration /> <p>First Name:<input type="text" name="fname" > </p> <p>Last Name:<input type="text" name="lname" > </p> <p>Phone Number:<input type="text" name="phone" ></p> <p>Address:<input type="text" name="address" ></p> <p>Department:<input type="text" name="department" ></p> <p>Email Address:<input type="text" name="email" ></p> <p>Level of Training:<input type="text" name="level" ></p> <input type="submit" name="btn_submit" value="Register"> </form> </body> </html> form <?php include_once('config1.php'); mysqli_connect($config['DB_HOST'], $config['DB_USER'], $config['DB_PASS']); mysqli_select_db(DB_NAME); ?> init.php file <?php $config['DB_HOST'] = 'localhost'; $config['DB_USER'] = ''; $config['DB_PASS'] = ''; $config['DB_NAME'] = ''; ?> config file..... I keep getting : Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 6 Thanks as always for you help!!
  7. Thanks CPD. Thanks seemed to fix the escape issues but I sill get Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'DB_USER'@'192.168.1.1' (using password: YES) in/www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 4 Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'vhostswww'@'192.168.1.1' (using password: NO) in/www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 6 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in/www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 6 These three errors.
  8. Ok Christian I attempted to change my code a bit and see if it helps and I am still having issues with connecting to my database. <?php include_once('init.php'); if (isset($_POST['fname'], $_POST['lname'], $_POST['phone'], $_POST['address'], $_POST['department'], $_POST['email'], $_POST['level'])) { $fname = mysqli_real_escape_string (htmlentities ($_POST['fname'])); $lname = mysqli_real_escape_string (htmlentities ($_POST['lname'])); $address = mysqli_real_escape_string (htmlentities ($_POST['address'])); $department = mysqli_real_escape_string (htmlentities ($_POST['departmenet'])); $email = mysqli_real_escape_string (htmlentities ($_POST['email'])); $level = mysqli_real_escape_string (htmlentities ($_POST['level'])); $query ="INSERT INTO Oktoberfest2013 SET 'First_Name'='{$fname}'; 'Last_Name'='{$lname}'; 'Phone'='{$phone}'; 'Address'='{$address}'; 'Department'='{$department}'; 'Email_Address'='{$email}'; 'Level_of_Training'='{$level}'"; mysqli_query($query); } ?> <html> <head> <title>Registration form for Octoberfest With O-G EMS 2013</title> </head> <body> <form action="" method="post"> <p Registration /> <p>First Name:<input type="text" name="fname" > </p> <p>Last Name:<input type="text" name="lname" > </p> <p>Phone Number:<input type="text" name="phone" ></p> <p>Address:<input type="text" name="address" ></p> <p>Department:<input type="text" name="department" ></p> <p>Email Address:<input type="text" name="email" ></p> <p>Level of Training:<input type="text" name="level" ></p> <input type="submit" name="btn_submit" value="Register"> </form> </body> </html> This is now my form information and here is a init.php <?php include_once('config1.php'); mysqli_connect(DB_HOST, DB_USER, DB_PASS); mysqli_select_db(DB_NAME); ?> I will not post my config1.php being that it has my personal information on it. But it is this type of format.... <?php $config['DB_HOST'] = 'localhost'; $config['DB_USER']= ''; $config['DB_PASS']=""; $config['DB_NAME']= ''; ?> Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'DB_USER'@'192.168.1.1' (using password: YES) in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 4 Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'vhostswww'@'192.168.1.1' (using password: NO) in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 6 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/init.php on line 6 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 13 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 14 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 15 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 16 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 17 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 18 Warning: mysqli_query() expects at least 2 parameters, 1 given in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/reg.php on line 32 Any suggestions?
  9. Thanks Christian, I have been doing html for a while now and was always interested in php but never really has a reason to use it. I am learning slowly but surely that what you say is very true. Thanks for the help and I am sure I will have more questions. I am glad that there are people like you guys who are willing to help.
  10. also if I remove the "$" from the front of the values I get this error....Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www/zzl.org/o/t/t/ottawaglandorfems/htdocs/class-db.php on line 22 Line 22 is $query = "INSERT INTO Oktoberfest2013 (First_Name, Last_Name, Phone, Address, Department, Email_Address, Level_of_Training ) VALUES ('fname', 'lname', 'phone', 'address', 'department, 'email', 'level')";
  11. Cpd I went back to something that I started with and I am still having trouble with. it is much shorter script. By the way I like your quote...... <?php require_once('config1.php'); function connect() { $sql = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if ($sql->connect_error) { die('Connect Error (' . $sql->connect_errno . ') ' . $sql->connect_error); } return $sql; } function insert($insert){ $sql=connect(); if ( $type == 'post' ) { $query = "INSERT INTO Oktoberfest2013 (First_Name, Last_Name, Phone, Address, Department, Email_Address, Level_of_Training ) VALUES ('$fname', '$lname', '$phone', '$address', '$department, '$email, '$level')"; if ( !$mysqli->query($query) ); }} ?> Here again is my form information..... <?php require_once('class-db.php'); /** * function to check the validity of the given string * $what = what you are checking (phone, email, etc) * $data = the string you want to check */ function isValid( $what, $data ) { switch( $what ) { // validate a phone number case 'phone': $pattern = "/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i"; break; // validate email address case 'email': $pattern = "/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i"; break; default: return false; break; } return preg_match($pattern, $data) ? true : false; } $errors = array(); if( isset($_POST['btn_submit']) ) { if( !isValid( 'phone', $_POST['phone'] ) ) { $errors[] = 'Please enter a valid phone number'; } if( !isValid( 'email', $_POST['email'] ) ) { $errors[] = 'Please enter a valid email address'; } } if( !empty($errors) ) { foreach( $errors as $e ) echo "$e <br />"; } if ( !empty ( $_POST ) ) { $type = 'post'; $insert = insert($type); } ?> <html> <head> <title>Registration form for Octoberfest With O-G EMS 2013</title> </head> <body> <form action="" method="post"> <p Registration /> <p>First Name:<input type="text" name="fname" > </p> <p>Last Name:<input type="text" name="lname" > </p> <p>Phone Number:<input type="text" name="phone" ></p> <p>Address:<input type="text" name="address" ></p> <p>Department:<input type="text" name="department" ></p> <p>Email Address:<input type="text" name="email" ></p> <p>Level of Training:<input type="text" name="level" ></p> <input type="submit" name="btn_submit" value="Register"> </form> </body> </html> Thanks again If you wanted me to do something different please let me know.
  12. No much as of yet new to php and learning.
  13. Ok but I it's not inserting anything either and that is more of my issue at this point.
  14. Oh ok I am not receiving any of my data in MySQL database. Thank you. Do you have any idea why that might be? But thanks again for the help on this issue.
×
×
  • 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.