Jump to content

Can someone please help!


rhouk

Recommended Posts

Can someone take a look at this script I've inherited.  For whatever reason it is not working and I can't figure out why.  It seems to not be passing the user input values into the mail() function??  You can go to www.francoisandco.com and click on the 2008 Catalog Request banner at top right to try it out. (I promise it won't work and you won't receive a catalog) 

 

It isn't receiving an error, so it displays the Thank You page, as if it works, but it doesn't send anything.  I have the $message values printing out (in white font) under the "Return" link, so you can highlight this area to see that the mail() function is never receiving the input values.  However, it is capturing the input values because I have it displaying your name input in the Thank You message.

 

They tell me it used to work, but I've not done anything to make it stop working.  I'm at a loss.

 

Here is the coding. The PHP script and form are all in this php file (which could be the problem, except they say it worked before). I have no idea.  Please help!!

 

<?PHP

 

if (isset($first)) {

$first=trim($first);

if($first=="") { $error=1;  }

}

 

if (isset($email)) {

$email=trim($email);

if($email=="") { $error=1;  }

}

 

 

if ( isset ($first) && (!isset ($error))) {

 

// security

$first = @strip_tags($first);

$first = @stripslashes($first);

$last = @strip_tags($last);

$last = @stripslashes($last);

$address = @strip_tags($address);

$address = @stripslashes($address);

$city = @strip_tags($city);

$city = @stripslashes($city);

$state = @strip_tags($state);

$state = @stripslashes($state);

$zip = @strip_tags($zip);

$zip = @stripslashes($zip);

$phone = @strip_tags($phone);

$phone = @stripslashes($phone);

$email = @strip_tags($email);

$email = @stripslashes($email);

$email_confirm = @strip_tags($email_confirm);

$email_confirm = @stripslashes($email_confirm);

 

$goback = $goback;

 

// Email copy to admin

$send_to = 'randy@francoisandco.com';

$subject = 'Catalog Request';

$message = '$first $last

 

$address

$city, $state $zip

 

$phone

$email';

 

$extra = 'From: $email';

 

mail($send_to, $subject, $message, $extra);

$success = true;

// header("Refresh: 5; url=index.php?section=contact");

}

?>

 

<html>

<head>

 

<title>

Lightbox Form

</title>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="js/validation.js"></script>

<script type="text/javascript">

<!--

if (parent.location.href == self.location.href) {

    if (window.location.href.replace)

        window.location.replace('http://www.francoisandco.com/');

    else

        // causes problems with back button, but works

        window.location.href = 'http://www.francoisandco.com/';

}

//  -->

 

</script>

<style type="text/css">

body {

background:#ffffff;

margin:0;

}

 

p.header {

color:#89180A;

font: normal 14px Didot, Verdana, Geneva, Arial, Sans Serif;

margin:10px 0 15px 0;

}

 

input {

display: inline;

padding: 0;

margin: 0;

font: normal 11px Verdana, Geneva, Arial, Sans Serif;

background:#F1ECD9;

}

 

form {

padding: 0;

margin: 0;

}

 

a {

color: #666666;

font: normal 10px Verdana, Geneva, Arial, Sans Serif;

margin: 0 0 0 0;

padding: 0;

text-decoration: underline;

}

 

a:hover {

color: #333333;

text-decoration: underline;

}

 

</style>

</head>

 

<body>

 

<form name="form1" method="post"action="form.php" onSubmit="return validateForm(this);">

<input type="hidden" name="goback" value="<? echo $return; ?>" />

<table border="0" width="900" cellspacing="0" cellpadding="0">

<tr>

<td valign="middle">

<img src="graphics/catalog.jpg" alt="" height="344" width="500" />

</td>

 

<td valign="top" style="padding-left:15px; padding-right:15px; padding-top:5px; width:400px">

<table border="0" width="370" cellspacing="0" cellpadding="2">

<tr>

 

<? if (isset($error)) { ?>

<td valign="top" colspan="3">

<p class="header" style="color:red;">Error! Check to make sure all required fields are filled in.</p>

</td>

<? } ?>

 

<? if (isset($success)) { ?>

<td valign="top" align="left">

<p class="header" style="float:left"><span style="font:bold 17px Didot, Georgia, Times, Times New Roman">Thank You, <? echo $first; ?>!</span><br />Your catalog is on its way and you should receive it within two weeks.<br /><br /><a href="<? echo $goback; ?>" onClick="window.parent.location.href='<? echo $goback; ?>'">Return To Site</a></p>

<p><font color="#FFFFFF"><? echo $message; ?></font></p>

</td>

 

<? } else { ?>

<td valign="top">

<table cellpading="0" cellspacing="0">

<tr>

<td valign="top" colspan="3">

<p class="header">To receive our <span style="font:bold 17px Didot, Georgia, Times, Times New Roman">2008 François & Co. Catalog</span>, <br />please complete and submit the form below.</p>

</td>

</tr>

 

<tr>

<td style="width:180px; text-align:left;"><font size="2mm" face="tahoma">First Name</font><br /><input type="text" name="first" value="" size="19" maxlength="50" style="margin:0 0 0 0;width:160px" />

</td>

<td colspan="2" style="text-align:left;"><font size="2mm" face="tahoma">Last Name</font><br /><input type="text" name="last" value="" size="19" maxlength="50" style="margin:0 0 0 0;width:100%" />

</td>

</tr>

<tr>

<td colspan="3" style="text-align:left;"><font size="2mm" face="tahoma">Address</font><br /><input type="text" name="address" value="" size="50" maxlength="50" style="margin:0 0 0 0;width:100%" />

</td>

</tr>

<tr>

<td style="text-align:left;"><font size="2mm" face="tahoma">City</font><br /><input type="text" name="city" value="" size="19" maxlength="50"  style="margin:0 0 0 0;width:160px" />

        </td>

        <td style="text-align:left;"><font size="2mm" face="tahoma">State</font><br /><input type="text" name="state" value="" size="19" maxlength="50" style="margin:0 0 0 0;width:104px" />

        </td>

        <td style="text-align:left;"><font size="2mm" face="tahoma">Zip</font><br /><input type="text" name="zip" value="" size="6" maxlength="10" style="margin:0 0 0 0;width:80px" />

        </td>

</tr>

 

<tr>

<td colspan="3" style="text-align:left;"><font size="2mm" face="tahoma">Phone</font><br /><input type="text" name="phone" value="" size="50" maxlength="50" style="margin:0 0 0 0;width:100%" /></td>

</tr>

<tr>

<td colspan="3" style="text-align:left;"><font size="2mm" face="tahoma">Email</font><br /><input type="text" name="email" value="" size="50" maxlength="50"  style="margin:0 0 0 0;width:100%" /></td>

</tr>

 

<tr>

<td colspan="3" style="text-align:left;"><font size="2mm" face="tahoma">Confirm Email</font><br /><input type="text" name="email_confirm" value="" size="50" maxlength="50" style="margin:0 0 5px 0;width:100%" /></td>

</tr>

 

<tr>

<td colspan="3" style="padding:10px 0 0 0">

<input type="submit" value="Submit" /> <input type="button"  class="lbAction" rel="deactivate" value="Cancel" onClick="window.parent.location.href='<? echo $return; ?>'">

</td>

       

</tr>

</table>

<? } ?>

</td>

</tr>

</table>

</td>

</tr>

</table>

</form>

 

</body>

</html>

Link to comment
Share on other sites

tippy is right.  Whoever coded that was lazy.  Just use 'replace all' in your texteditor.

 

replace $first with $_POST['first'] and so on.  It'll save you time fixing whatever shouldn't have been replaced rather than changing everything manually.

Link to comment
Share on other sites

Thanks for you help.  I corrected the $_POST issue, and also realized that the single quotes in the $message variable was causing it not to capture the input values.  Once I switched to regular quotes it worked properly.

 

Thanks again for your fast response and advise!!!

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.