| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #26 (permalink) |
| Senior Member Join Date: Nov 2005 Location: Hong Kong
Posts: 1,154
![]() ![]() ![]() | please post the code again, it is a syntax error now.
__________________ If you're as bored as I am, join me in Fallensword! (I swear, this game is actually pretty fun :P) |
| |
| | THREAD STARTER #27 (permalink) |
| NamePros Regular Join Date: Mar 2006 Location: Wigan, UK
Posts: 522
![]() | hi, it all here. <? require_once("conn.php"); require_once("includes.php"); $q1 = mysql_query("SELECT * FROM re2_agents WHERE AgentID = '".intval($_GET['AgentID'])."'") or die(mysql_error()); $a1 = mysql_fetch_array($q1); if(isset($_POST['s1'])) { $to = $a1['email']; $subject = $_POST['subject']; $message = $_POST['message']; $message .= 'Property:'."\n".$site_url.'/info.php?id='.intval($_GET['ListingID'])."\n\n"; $headers .= 'Content-type: text/plain; charset=iso-8859-1'."\r\n"; $headers .= 'Content-Transfer-Encoding: 8bit'."\r\n"; $headers .= 'From: '.$_POST['u_name'].' <'.$_POST['u_email'].'>'."\r\n"; if(!@mail($to, $subject, $message, $headers)) { echo "error"; } $thankyou = '<center><b><br><br><br>Thank you for your message!<br><br><a class=RedLink href="'.$site_url.'/info.php?id='.intval($_GET['ListingID']).'">back to the property details</a></center>'; require_once("templates/HeaderTemplate.php"); require_once("templates/EmailThankyouTemplate.php"); require_once("templates/FooterTemplate.php"); } $AgentName = $a1['FirstName'].' '.$a1['LastName']; if(!empty(intval($_GET['ListingID']))) { $SubjectLine = "Property ID ".intval($_GET['ListingID']); } require_once("templates/HeaderTemplate.php"); require_once("templates/EmailTemplate.php"); ????: NamePros.com http://www.namepros.com/programming/197931-np-50-for-resolving-issue.html require_once("templates/FooterTemplate.php"); ?> |
| |
| | #29 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: |
| |
| | THREAD STARTER #30 (permalink) |
| NamePros Regular Join Date: Mar 2006 Location: Wigan, UK
Posts: 522
![]() | hi, done excatly like you suggested but still no joy. when i click send "error" comes up in the left side, though something strange happens. a thank you message comes up and the form box aswell. have a look http://www.cheap-florida-holiday.com/email.php also no emails are comming through. what should i try? cheers i am thankful for all suggestions! |
| |
| | #31 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | When I "sent" email via your form, there was no "listing_id" or "agent_id" in the querystring, so if there isn't then the variables that are defined by using "$_GET['listingID']" etc... won't be there, and therefore it cant search the database for that agent id because there isn't one there to search with. There are two ways to check for this: both done in code below: PHP Code: |
| |
| | #33 (permalink) | ||||
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
PHP Code: PHP Code: | ||||
| |
| | #34 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | the problem is that it isn't getting anything from the database. This is because you aren't sending a listingid and a agentid to the script. Is there an agent in your database? if there is, in the html with the form in it so this: <form method="post" action="emailscript.php?AgentID=#an agent id here that is in your database#&ListingID=#a listing id here that is in your database#"> that will send an agent Id and a listing Id to the script as well. |
| |
| | THREAD STARTER #35 (permalink) |
| NamePros Regular Join Date: Mar 2006 Location: Wigan, UK
Posts: 522
![]() | thanks for everyone who tried to help me out. just figured what the problem was. the contact page can only be used by people who are signed in. simple problem. i'll just put a formtomail cgi script on it. thanks again for all the help. |
| |