Log in

View Full Version : Form not Working - Please help!



leighgoodman
07-17-2007, 10:11 PM
Hi there

I havnt used php in a while, so im a bit rusty. My form doesnt seem to be working. I am not getting any errors, but the info that the user submits doesnt get emailed to the required email address.

I am working on a staging site - http://www.thequirky.co.uk/staging/signup.php

Can anyone please assist me

Thanks
Leigh

This is my code for the thanks page:

<!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>The Quirky - Psychedelic | Acoustic | Folk Rock </title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadImages('images/butMusicO.gif','images/butNewsO.gif','images/butMySpaceO.gif','images/butBuyO.gif','images/butContactO.gif')">



<div><img src="images/topImage.jpg" width="757" height="159" border="0" /></div>
<div id="container" style="float:left">
<div class="leftBlock">
<div><img src="images/LeftNavBarTop.gif" /></div>
<div class="leftBlockMiddle" style="float:left">
<p><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/butMusicO.gif',1)"><img src="images/butMusic.gif" name="Image4" width="93" height="21" border="0" id="Image4" /></a>
<br />
<a href="news.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/butNewsO.gif',1)"><img src="images/butNews.gif" name="Image5" width="93" height="21" border="0" id="Image5" / style="margin-top:4px;"></a>
<br />
<a href="gigs.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/butGigsO.gif',1)"><img src="images/butGigs.gif" name="Image6" width="93" height="21" border="0" id="Image6" / style="margin-top:4px;"></a>
<br />
<a href="photos.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','images/butPhotosO.gif',1)"><img src="images/butPhotos.gif" name="Image16" width="93" height="21" border="0" id="Image16" / style="margin-top:4px;"></a></p>

</div>
<div><img src="images/LeftNavBarBottom.gif" /></div>
<div style="margin-top:20px; margin-left:18px; line-height:20px">
<p>> <a href="myspace.html"><strong>Myspace</strong></a><br />
> <a href="signup.php"><strong>Signup</strong></a><br />
> <a href="buy.html"><strong>Buy</strong></a><br />
> <a href="contact.html"><strong>Contact</strong></a><br />
> <a href="links.html"><strong>Links</strong></a></p>
</div>
</div>

<div class="middleContainer">

<?
// email to client

$clientmessage .= "Dear $txtFirstName\r\n\r\n";
$clientmessage .= "Thank you for subscribing to The Quirky. This is an automated response confirming that we have received your subscription. \r\n\r\n";

$clientmessage .= "Kind Regards,\r\n";
$clientmessage .= "The Quirky";

$toemail = $txtEmail;
$subject = "The Quirky - Subscription";
$fromemail = "info@thequirky.co.uk";

mail($toemail, $subject, stripslashes($clientmessage),
"From: $fromemail\r\n"
."X-Mailer: PHP/" . phpversion());


$fullmessage = "";
$fullmessage .= "---------------------------------------------------\r\n";
$fullmessage .= "The Quirky - Quick Enquiry\r\n";
$fullmessage .= "---------------------------------------------------\r\n\r\n";
$fullmessage .= "From: $txtFirstName $txtLastName\r\n";
$fullmessage .= "Email: $txtEmail\r\n";
$fullmessage .= "Telephone: $txtTel\r\n";
$fullmessage .= "Country: $txtCountry\r\n";


$fullmessage .= "---------------------------------------------------\r\n\r\n";
$fullmessage .= "AUTO-EMAIL SENT TO ENQUIRER ALREADY:\r\n\r\n";
$fullmessage .= "$clientmessage\r\n\r\n";
$fullmessage .= "---------------------------------------------------\r\n\r\n";


$toemail = "info@zouklambada.com, dance@zouklambada.com";
$subject = "The Quirky - Quick Enquiry";
$fromemail = $txtEmail;

mail($toemail, $subject, stripslashes($fullmessage),
"From: $fromemail\r\n"
."X-Mailer: PHP/" . phpversion());
?>

<div class="MiddleBlockLong">
<h1>Thanks for signing up!</h1>
<p>Text to go here </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</div>
<div><img src="images/containerBottom.gif" width="727" height="25" border="0" /></div>
</div>

</body>
</html>

Demonicman
07-20-2007, 01:01 PM
holy crap! make it easier on yourself using the site wizard


<?
/*
CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.07
Generated by thesitewizard.com's Feedback Form Wizard.
Copyright 2000-2006 by Christopher Heng. All rights reserved.
thesitewizard and thefreecountry are trademarks of Christopher Heng.

$Id: phpscript.txt,v 1.8 2006/02/28 13:07:11 developer Exp $

Get the latest version, free, from:
http://www.thesitewizard.com/wizards/feedbackform.shtml

You can read the Frequently Asked Questions (FAQ) at:
http://www.thesitewizard.com/wizards/faq.shtml

I can be contacted at:
http://www.thesitewizard.com/feedback.php
Note that I do not normally respond to questions that have
already been answered in the FAQ, so *please* read the FAQ.

LICENCE TERMS

1. You may use this script on your website, with or
without modifications, free of charge.

2. You may NOT distribute or republish this script,
whether modified or not. The script can only be
distributed by the author, Christopher Heng.

3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE
IMPLIED WARRANTY OF MECHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND
LIABILITIES ARISING FROM THE USE OF THE SCRIPT,
ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE
SCRIPTS AND THE DOCUMENTATION.

If you cannot agree to any of the above conditions, you
may not use the script.

Although it is NOT required, I would be most grateful
if you could also link to thesitewizard.com at:

http://www.thesitewizard.com/

*/

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "youremailaddress@example.com" ;

$mailto = 'blank@blank.com' ;

// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;

$subject = "blank" ;

// the pages to be displayed, eg
//$formurl = "http://www.example.com/feedback.html" ;
//$errorurl = "http://www.example.com/error.html" ;
//$thankyouurl = "http://www.example.com/thankyou.html" ;

$formurl = "http://www.blank.com" ;
$errorurl = "http://www.blank.com" ;
$thankyouurl = "http://www.blank.com" ;

$uself = 0;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

?>

alexjewell
07-20-2007, 05:56 PM
I don't see any $_POST or $_GET's to get the info from the form in order to send it...

Smimmon
08-22-2007, 01:54 PM
Why not use a php contact form generator? Like http://40secscontactform.com
It has all the functions and is very easy to use.

boogyman
08-22-2007, 03:15 PM
1. please use the minus dots when you submit any type of computer coding

2.

Hi there

I havnt used php in a while, so im a bit rusty. My form doesnt seem to be working. I am not getting any errors, but the info that the user submits doesnt get emailed to the required email address.

that is because you have a few errors in your php script.



<?
$toemail = $txtEmail;
$subject = "The Quirky - Subscription";
$fromemail = "info@thequirky.co.uk";

mail($toemail, $subject, stripslashes($clientmessage),
"From: $fromemail\r\n"
."X-Mailer: PHP/" . phpversion());


...

$toemail = "info@zouklambada.com, dance@zouklambada.com";
$subject = "The Quirky - Quick Enquiry";
$fromemail = $txtEmail;

mail($toemail, $subject, stripslashes($fullmessage),
"From: $fromemail\r\n"
."X-Mailer: PHP/" . phpversion());
?>

you are attempting to send the email 2 times also, no where in your script have you defined how to get the info from the form either via the GET / POST Method so when you do get the email address sorted you will just see your hardcoded text, nothing would be populated from the form. I would suggest that you use one of the scripts above