Jump to content

Cathryn

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Cathryn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That works but what is whong with my phpmyadmin query?
  2. Please assist, i am new to php and i am trying to retrieve information from my database but i am failing to display and there is something wrong with my where query. Here is my code <?php // Make a MySQL Connection mysql_connect("localhost", "root", "") or die(mysql_error()); echo "Connected to MySQL<br />"; // Make a MySQL db Connection mysql_select_db("dreamhome") or die(mysql_error()); echo "Connected to Database"; // Construct our join query $query = "SELECT branch.city, property.city ". "FROM branch, property ". "WHERE branch.city != NULL && property.city = NULL"; $result = mysql_query($query) or die(mysql_error()); echo $row['city']; ?>
  3. Its working now, thanks again!
  4. Even after removing the clean_string() and using the $email_message code is not working. $email_message = "In ".$city . " in the month of " . $month.$year." you observed the following weather: ""\n"; $check =0; $top = array('Sunshine', 'Clouds', 'Rain', 'Hail', 'Sleet', 'Snow', 'Wind', 'Cold', 'Heat', 'Fog', 'Humidity'); foreach ($_POST['type'] as $type){ echo "<li>$type</li> \r\n"; }
  5. After fixing the tags, the problem is mainly the logic to allow the email to send what the user as put inside the form. The $email_message string is giving errors hence i cannot email the form results to the user.
  6. Thank you so much, the code you sent helped with what i needed.
  7. Hello, I am a beginner and i am trying to send an email that shows what weather the person experienced from information they fill out on a form. This is the form: <html> <body> <form method="post" action="email.php"> <p><h2>How is your weather now?</h2></p> <p>Please enter your information: </p> <p> City:<input type="text" name="city"> Month:<input type="text" name="month"> Year:<input type="text" name="year"> </p> <p>Please choose the kinds of weather you experienced from the list below.<br> Choose all that apply.</p> <p> <input type="checkbox" value="Sunshine" name="type[]">Sunshine<br> <input type="checkbox" value="Clouds" name="type[]">Clouds<br> <input type="checkbox" value="Rain" name="type[]">Rain<br> <input type="checkbox" value="Hail" name="type[]">Hail<br> <input type="checkbox" value="Sleet" name="type[]">Sleet<br> <input type="checkbox" value="Snow" name="type[]">Snow<br> <input type="checkbox" value="Wind" name="type[]">Wind<br> <input type="checkbox" value="Cold" name="type[]">Cold<br> <input type="checkbox" value="Heat" name="type[]">Heat<br> <input type="checkbox" value="Fog" name="type[]">Fog<br> <input type="checkbox" value="Humidity" name="type[]">Humidity </p> Anything Else? Please list in the additional weather conditions in box, separated by commas.<br> <input type="text", name="add" size="50"><br> <input type=submit name="submit" value="Go"> </form> </body> </html> and here is the email coding: <?php if(isset($_POST['email'])) { $email_to = "youremail@gmail.com"; $email_subject = "<h1>How is your weather now</h1>"; $city = $_POST['city']; $month = $_POST['month']; $year = $_POST['year']; $type = $_POST['type']; $add = $_POST['add']; $email_message .= "In ".clean_string($city) . " in the month of " .clean_string($month).clean_string($year)." you observed the following weather: ""\n"; <?php $check =0; $top = array('Sunshine', 'Clouds', 'Rain', 'Hail', 'Sleet', 'Snow', 'Wind', 'Cold', 'Heat', 'Fog', 'Humidity'); foreach ($_POST['type'] as $type){ echo "<li>$type</li> \r\n"; } ?> // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> I keep getting errors on the part where i put the message body of the email. Any help would be greatly appreciated!
  8. Hello, I am a beginner and i am trying to send an email that shows what weather the person experienced from information they fill out on a form. This is the form: <html> <body> <form method="post" action="email.php"> <p><h2>How is your weather now?</h2></p> <p>Please enter your information: </p> <p> City:<input type="text" name="city"> Month:<input type="text" name="month"> Year:<input type="text" name="year"> </p> <p>Please choose the kinds of weather you experienced from the list below.<br> Choose all that apply.</p> <p> <input type="checkbox" value="Sunshine" name="type[]">Sunshine<br> <input type="checkbox" value="Clouds" name="type[]">Clouds<br> <input type="checkbox" value="Rain" name="type[]">Rain<br> <input type="checkbox" value="Hail" name="type[]">Hail<br> <input type="checkbox" value="Sleet" name="type[]">Sleet<br> <input type="checkbox" value="Snow" name="type[]">Snow<br> <input type="checkbox" value="Wind" name="type[]">Wind<br> <input type="checkbox" value="Cold" name="type[]">Cold<br> <input type="checkbox" value="Heat" name="type[]">Heat<br> <input type="checkbox" value="Fog" name="type[]">Fog<br> <input type="checkbox" value="Humidity" name="type[]">Humidity </p> Anything Else? Please list in the additional weather conditions in box, separated by commas.<br> <input type="text", name="add" size="50"><br> <input type=submit name="submit" value="Go"> </form> </body> </html> and here is the email coding: <?php if(isset($_POST['email'])) { $email_to = "youremail@gmail.com"; $email_subject = "<h1>How is your weather now</h1>"; $city = $_POST['city']; $month = $_POST['month']; $year = $_POST['year']; $type = $_POST['type']; $add = $_POST['add']; $email_message .= "In ".clean_string($city) . " in the month of " .clean_string($month).clean_string($year)." you observed the following weather: ""\n"; <?php $check =0; $top = array('Sunshine', 'Clouds', 'Rain', 'Hail', 'Sleet', 'Snow', 'Wind', 'Cold', 'Heat', 'Fog', 'Humidity'); foreach ($_POST['type'] as $type){ echo "<li>$type</li> \r\n"; } ?> // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> I keep getting errors on the part where i put the message body of the email. Any help would be greatly appreciated!
  9. This is what i am trying to get. For the 1st session: This is your first session. And for the others after that: Your previous session was on: 21 Jun 2011 11:52:05 21 Jun 2011 12:50:21 21 Jun 2011 12:32:45 I understand i need a for loop to get the times to record but the code i have is ending in the first session. <?php session_start(); $_SESSION['views']=1; if(($_SESSION['views'])==1){ echo "This is your first visit"; } elseif(($_SESSION['views'])> 1){ echo "You previously visited this page on: "; for($i=1;$i > 1; $i++){ echo date("D, d F Y - G:i:s"); } } ?>
  10. Hello, i am trying to write a program using sessions that states if its the user's 1st visit. If its not it should write the date and time of the last visit. This is the code i have but it is not working past the 1st visit. Any help would be much appreciated. <?php session_start(); if(($_SESSION['views'])== 1){ echo "This is your first visit."; ?> <?php } ($_SESSION['views']+ 1) else(($_SESSION['views'])< 1){ echo "This is your visit"<br>; echo "You previously visited this page on "; echo date("d F Y"); } ?>
  11. Please i am very very desparate for anybody to help me with this. I am a beginner and i want to build a career in web developement but im having a really tough time understanding. We got this tutorial in class and i have been trying to crack it for 2 days with no luck even after searching google day & night and they all dont work i end up even more confused. Anybody please please help me!!!!! Question i. Create a simple Facebook registration page : ii. Check for duplicate email (10 marks) iii. The “Email” and “reenter email” must be the same (10 marks) iv. If user is less than 18 yrs old, show “you are underaged, cannot register” (20 marks) v. Store the record in the database and show in PHPMyAdmin (10 marks)
×
×
  • 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.