NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Np$ 50 for resolving issue.

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-23-2006, 02:50 AM   #26 (permalink)
Senior Member
Join Date: Nov 2005
Location: Hong Kong
Posts: 1,154
aznchong91 is a jewel in the roughaznchong91 is a jewel in the roughaznchong91 is a jewel in the rough
 



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)
aznchong91 is offline  
Old 05-23-2006, 06:02 AM THREAD STARTER               #27 (permalink)
NamePros Regular
 
fried-chicken's Avatar
Join Date: Mar 2006
Location: Wigan, UK
Posts: 522
fried-chicken will become famous soon enough
 




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");

?>
__________________
Wigan Web Design | Watches UK | Canvas Pop Art
fried-chicken is offline  
Old 05-24-2006, 11:28 AM THREAD STARTER               #28 (permalink)
NamePros Regular
 
fried-chicken's Avatar
Join Date: Mar 2006
Location: Wigan, UK
Posts: 522
fried-chicken will become famous soon enough
 




bump
__________________
Wigan Web Design | Watches UK | Canvas Pop Art
fried-chicken is offline  
Old 05-24-2006, 12:40 PM   #29 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
PHP Code:
<?

require_once("conn.php");
require_once(
"includes.php");

//Move to vars, easier to work with.
$ListingID intval($_GET['ListingID']);
$AgentID intval($_GET['AgentID']);

????: NamePros.com http://www.namepros.com/showthread.php?t=197931
$q1 mysql_query("SELECT * FROM re2_agents WHERE AgentID = ".$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='.$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='.$ListingID.'">back to the property details</a></center>';

  require_once(
"templates/HeaderTemplate.php");
  require_once(
"templates/EmailThankyouTemplate.php");
  require_once(
"templates/FooterTemplate.php");
????: NamePros.com http://www.namepros.com/showthread.php?t=197931
}

$AgentName $a1['FirstName'].' '.$a1['LastName'];

/*
Here is where the error occured, in what I originally posted it 
was because I forgot that:

"empty() only checks variables as anything else will result in a 
parse error. In other words, the following will not work: 
empty(trim($name))."
*/
if(!empty($ListingID))
{
  
$SubjectLine "Property ID ".$ListingID;
}

require_once(
"templates/HeaderTemplate.php");
require_once(
"templates/EmailTemplate.php");
require_once(
"templates/FooterTemplate.php");

?>
Eric is offline  
Old 05-24-2006, 01:14 PM THREAD STARTER               #30 (permalink)
NamePros Regular
 
fried-chicken's Avatar
Join Date: Mar 2006
Location: Wigan, UK
Posts: 522
fried-chicken will become famous soon enough
 




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!
__________________
Wigan Web Design | Watches UK | Canvas Pop Art
fried-chicken is offline  
Old 05-24-2006, 03:25 PM   #31 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



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:
<? 

require_once("conn.php"); 
require_once(
"includes.php"); 

//Move to vars, easier to work with. 
$ListingID intval($_GET['ListingID']); 
$AgentID intval($_GET['AgentID']); 

$q1 mysql_query("SELECT * FROM re2_agents WHERE AgentID = ".$AgentID) or die(mysql_error());
//
// THIS IS THE FIRST ERROR CHECK
// IF AGENT ID IS EMPTY THERE WILL
// BE NO ROWS RETURNED
//
if(mysql_num_rows($q1)<1){
  echo 
"no rows returned...";
}
// --
$a1 mysql_fetch_array($q1); 

if(isset(
$_POST['s1'])) 

  
$to $a1['email']; 
  
//
  // SECOND WAY TO TEST...
  // SEE IF to VAR IS
  // EMPTY OR NOT
  //
  
if(empty($to)){
    echo 
"no email address to send to...";
  }
  
// --
  
$subject $_POST['subject']; 
  
$message $_POST['message']; 
  
$message .= 'Property:'."\n".$site_url.'/info.php?id='.$ListingID."\n\n"

  
$headers .= 'Content-type: text/plain; charset=iso-8859-1'."\r\n"
  
$headers .= 'Content-Transfer-Encoding: 8bit'."\r\n"
????: NamePros.com http://www.namepros.com/showthread.php?t=197931
  
$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='.$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']; 

/* 
Here is where the error occured, in what I originally posted it  
was because I forgot that: 
????: NamePros.com http://www.namepros.com/showthread.php?t=197931

"empty() only checks variables as anything else will result in a  
parse error. In other words, the following will not work:  
empty(trim($name))." 
*/ 
if(!empty($ListingID)) 

  
$SubjectLine "Property ID ".$ListingID


require_once(
"templates/HeaderTemplate.php"); 
require_once(
"templates/EmailTemplate.php"); 
require_once(
"templates/FooterTemplate.php"); 

?>
see what that turns up
PoorDoggie is offline  
Old 05-25-2006, 01:41 AM THREAD STARTER               #32 (permalink)
NamePros Regular
 
fried-chicken's Avatar
Join Date: Mar 2006
Location: Wigan, UK
Posts: 522
fried-chicken will become famous soon enough
 




hi,
it says

no rows returned...no email address to send to...error
__________________
Wigan Web Design | Watches UK | Canvas Pop Art
fried-chicken is offline  
Old 05-25-2006, 02:18 AM   #33 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Originally Posted by fried-chicken
hi,
it says

no rows returned...no email address to send to...error
Hmm... change
PHP Code:
//Move to vars, easier to work with.
$ListingID intval($_GET['ListingID']);
$AgentID intval($_GET['AgentID']); 
to
PHP Code:
//Move to vars, easier to work with.
$ListingID intval($_GET['ListingID']);
$AgentID intval($_GET['AgentID']);
????: NamePros.com http://www.namepros.com/showthread.php?t=197931

echo 
$ListingID ' ' $AgentID '<br />'
and run it.. post what it says here.
Eric is offline  
Old 05-25-2006, 03:46 AM   #34 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



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.
PoorDoggie is offline  
Old 05-28-2006, 11:13 AM THREAD STARTER               #35 (permalink)
NamePros Regular
 
fried-chicken's Avatar
Join Date: Mar 2006
Location: Wigan, UK
Posts: 522
fried-chicken will become famous soon enough
 




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.
__________________
Wigan Web Design | Watches UK | Canvas Pop Art
fried-chicken is offline  
Old 05-29-2006, 11:52 AM   #36 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



hmm.. ok - simple explination.

Hope it all works out for you.
PoorDoggie is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:53 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger