Re: Why wont my script mail in explorer, but ok in Firefox?
- From: Michael Austin <maustin@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 31 Jan 2009 17:33:30 -0600
Jeff North wrote:
On Sat, 31 Jan 2009 06:38:26 -0800 (PST), in comp.lang.php Nosferatum
<John.Olav.O@xxxxxxxxx>
<5521501c-5902-490f-a416-885af53cf3a9@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
| > > <?php
| > > session_start();
| >
| > > $_SESSION['MrMs'];
| > > $_SESSION['first_name'];
| > > $_SESSION['last_name'];
| > > $_SESSION['email_submitted'];
| >
| > > error_reporting(E_ALL);
| >
| > > $sendto = $_SESSION['email_submitted']; <====== REPORTED AS
| > > Undefined index: email_submitted
| >
| > > What does it mean? Is thsi the reason why it stops in explorer and not
| > > in firefox?
[sig snip]
| But, how is that done correctly?
| | From the form process I put the values in mysql and email the values
| to a given mail. The top of this page declare sessions, like: $_SESSION
| ['email_submitted']=$_POST['email_submitted']; (email_submitted is as
| post value from the form)
| Then redirects to the page which is causing me trouble, coffee in
| liters and headache. This page begins with <php session_start();
| Then I declare the session variables, like $sendto=$_SESSION
| ['email_submitted'];
| In the mail i use the variable $sendto as the recipent.
| Could this be a header problem?
The fact that the code works in one browser an not another indicates
it is a browser problem. Here are several things you should try. Try
them one at a time so you know where the problem lies.
On the above page add (this will show the state of the variables):
var_dump($_SESSION);
exit;
Your html code might be missing something.
<input type='text' name='email_submitted'> If the user doesn't place any text within this text box then it will
not be submitted. Change it to:
<input type='text' name='email_submitted' value=''>
On the page where you process your submitted data change:
$_SESSION['email_submitted']=$_POST['email_submitted'];
to
$_SESSION['email_submitted'] = isset($_POST['email_submitted']) ?
$_POST['email_submitted'] : "not set";
Replace $sendto = $_SESSION['email_submitted'];
with $sendto = isset($_SESSION['email_submitted']) ?
$_SESSION['email_submitted'] : "blank";
or better yet (not tested or reviewed for accuracy) -
if (!isset($_SESSION['email_submitted'])
{
echo "ERROR ON PAGE TRY AGAIN";
} else
$sendto = isset($_SESSION['email_submitted']) ? $_SESSION['email_submitted'] : "blank";
.....
blahblahblah...
}
The reason is that you would want to raise an error should this particular variable be empty anyway... because if it is emtpy - the rest of your processing will fail... I have a page that does something similar (get message, get email address, etc...) and I check all of the variables up front 1) to ensure it is not being used as a spam host (multiple "to" addresses) and 2) all of the fields are correctly filled in. But YMMV.
Remove the @ from : $ok = @mail($to,$subject,$message,$headers);
setting $to = $sendto = $_SESSION['email_submitted'] seems a little redundant but it is your code... I tend to try and keep it as simple as possible so that some second or third translation doesn't get lost along the way.
.
If the above fails then your cookies folder could be corrupted in IE.
Delete all cookies.
HTH
- Follow-Ups:
- Re: Why wont my script mail in explorer, but ok in Firefox?
- From: Jeff North
- Re: Why wont my script mail in explorer, but ok in Firefox?
- Next by Date: Re: DOMDocument()
- Next by thread: Re: Why wont my script mail in explorer, but ok in Firefox?
- Index(es):
Relevant Pages
|