Jump to content

Blank and ducplicate emails from mail()


haxormax

Recommended Posts

Hey Guys,

I am helping someone create an advisor nomination form for GMU. We get the emails, but whenever you access the page for the first time, you get a blank email. Whenever you hit reload, you get another email with the same information you put in before the reload. at 1:30 in the morning today, we got 8 emails with nothing in them. I think that might have been the server as no one knows the site address.

view it here also : http://advisoroftheyear.gmu.edu/

Any help ASAP would be awesome, as it's due Friday.

 

Here's the php:

------------------------------

<?php

if(empty($advisorsName) || empty($advisorDepartment) || empty($nominatedBy) || empty($reason) || empty($status)){echo"<h2> Please click the back button and fill in all the fields</h2>\n";}

else{

@extract($_POST);

$to = "somename@gmu.edu";

$advisorsName = "\nAdvisors Name: " . stripslashes($advisorsName);

$advisorDepartment = "\nAdvisors Department: " . stripslashes($advisorDepartment);

$nominatedBy = "\nNominated By: " . stripslashes($nominatedBy);

$major = "\nMajor: " . stripslashes($major);

$reason = "\nReason: " . stripslashes($reason);

$status = "\nStatus: " . $status;

$answers = $advisorsName . $major . $advisorDepartment . $status . $nominatedBy . $reason;

$subject = "Advisor Nomination";

mail($to, $subject, $answers, 'From: AdvisorNomination@gmu.edu');

}

?>

 

 

Here's the HTML

------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Academic Advisor of the Year Award</title>

<style type="text/css">

<!--

.style1 {font-size: 12px}

.style2 {font-size: 14px; }

.style3 {font-size: 18px; }

.style4 {font-size: 16px; }

#container{margin-left: auto; margin-right: auto; width: 700px; text-align: left;color:#000;}

-->

</style>

</head>

 

<body>

<img src="images/logo.jpg" alt="logo" width="740" height="150" />

<div id="container">

<h2 class="style3">Purpose</h2>

<p class="style2">Academic advisors are a vital part of student success. The purpose of this award is to recognize excellence in advising. If you have been advised by or know of an advisor who has had a positive impact on students, please submit the advisor's name for consideration for the undergraduate Academic Advisor of the Year Award. The recipient of the award will be honored at the annual Advising Roundtable which will be held on March 28, 2007.</p>

<h2 class="style3">Procedure</h2>

<p class="style2">All students, faculty and staff are eligible to nominate an undergraduate advisor. Any individual serving as an undergraduate academic advisor, undergraduate faculty academic advisor, or advising administrator is eligible for the award with the exception of advisors from the Academic Advising Center, SUB I, Room 304. <strong>Nominations are due by 5 pm, March 9th, 2007</strong>.</p>

<h2 class="style3">Criteria</h2>

<p class="style2">The Selection Committee will evaluate nominations based on the following criteria:</p>

<ul type="disc">

<li class="style2">Caring, helpful attitude toward students</li>

<li class="style2">Provides accurate information regarding university academic requirements</li>

<li class="style2">Availability to students, faculty, or staff</li>

<li class="style2">Makes appropriate referrals</li>

<li class="style2">Knowledge of George Mason University regulations, policies, and procedures</li>

<li class="style2">Supports student development through advising</li>

<li class="style2">Represents the <em>Spirit of Mason</em></li>

</ul>

<h2 class="style4">All Information Provided will Remain Confidential</h2>

<form id="form1" name="form1" method="post" action="">

<p>Academic Advisor's Full Name:<br />

<input name="advisorsName" type="text" id="advisorsName" size="35" />

</p>

<p>Academic Advisor's Department:<br />

<label>

<input name="advisorDepartment" type="text" id="advisorDepartment" size="35" />

</label>

</p>

<p>Nominated By:<br />

<input name="nominatedBy" type="text" id="nominatedBy" size="35" />

</p>

<p>Major (if you're a student):<br />

<input name="major" type="text" id="major" size="35" />

<br />

<br />

University Status <br />

<input name="status" type="radio" value="freshman" />

Freshman<br />

<input name="status" type="radio" value="sophmore" />

Sophomore<br />

<input name="status" type="radio" value="junior" />

Junior<br /><input name="status" type="radio" value="senior" />

Senior<br />

<input name="status" type="radio" value="faculty/staff" />

Faculty/Staff<br />

<input name="status" type="radio" value="other" />

Other

<input name="otherStatus" type="text" id="otherStatus" value="" />

</p>

<p><strong>Reason</strong>: <br />

Briefly explain why you feel this advisor should be the Academic Advisor of the year. If possible, give specific examples.<br />

<textarea name="reason" cols="75" rows="10"></textarea>

</p>

<p>To complete your nomination please click on the <strong>"Submit Nomination"</strong> button below. Thank you for taking the time to submit a nomination. If you have any questions, please contact the Academic Advising Center at 703.993.2470, SUB I, Room 304.</p>

<p>

<input name="Submit" type="submit" id="Submit" value="Submit Nomination" />

<input name="reset" type="reset" id="reset" value="Reset" />

</p>

<p class="style1"> </p>

</form>

</div>

</body>

</html>

--------------------------------

 

Some one suggested, myform.php?action=send, but I don't understand how to implement that. I don't know a whole lot about PHP. Can some one give me a code fix for this? It would be a huge help!

 

OK thank you very much!

 

 

 

 

 

Link to comment
Share on other sites

One thing for certain is your form field validation isn't working as I was able to submit the form twice when it was completely blank. That's probably because you're using the variables which haven't been declared or set.

 

if(empty($advisorsName) || empty($advisorDepartment) || empty($nominatedBy) || empty($reason) || empty($status))

 

Try it this way:

 

if(empty($_POST['advisorsName']) || empty($_POST['advisorDepartment']) || empty($_POST['nominatedBy']) || empty($_POST['reason']) || empty($_POST['status']))

 

This way it will check against the actual posting of the field values. The variables have to be set in order for the emails to contain anything. Like this:

 

$advisorsName = $_POST['advisorsname'];

$advisorDepartment = $_POST['advisordepartment'];

 

etc. for each field in your form. Then they will also be populated in your email.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.