Location: PHPKode > scripts > PHP Classified script made easy > php-classified-script-made-easy/openclassifiedsdownload24124/Files/contact.php
<?PHP
include("inc/header.php");
$id = $_GET['id'];
if(!isset($id)){
echo "<meta http-equiv='refresh' content='0;url=index.php'>";
} else {
if(isset($_GET['submit'])){
$i = $_GET['id'];
$Name = $_GET['name'];
$emailf = $_GET['email'];
$back = "SELECT * FROM classifieds WHERE adid = '$i' limit 1";
$query2 = mysql_query($back) or die (mysql_error());
while($row = mysql_fetch_array($query2, MYSQL_ASSOC)){
$recipient = $row['email'];
}
// CHANGE THE FOLLOWING IF THE LINKS ARE NOT WORKING RIGHT. YOU MAY MANUALLY CHANGE THE LINKS.
$mail_body = $_GET['body'];
$subject = "Classifieds Message: ".$_GET['subject'];
$headers = "From: ". $Name . " <" . $emailf . ">\r\n";
$headers .= "Content-type: text/html\r\n"; 

mail($recipient, $subject, $mail_body, $headers);
echo "<script type='text/javascript'>alert('Seller Contacted! Redirecting...');</script>";
echo "<meta http-equiv='refresh' content='0;url=index.php'>";
} else {
?>
<!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" />
<?PHP include("inc/meta.php"); ?>
<title><?PHP include("inc/title.php"); ?></title>
<link href="inc/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function goto(url)
{
document.location.href=(url);
}
</script>
<style type="text/css">
<!--
.style52 {font-family: Geneva, Arial, Helvetica, sans-serif}
-->
</style>
</head>

<body>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="70" valign="bottom"><a href="index.php"><img src="images/logo.gif" alt="Petoskey Classifieds - Northern Michigan Classifieds" width="450" height="62" border="0" /></a></td>
    <td class="head"><div align="right" class="style1"><a href="index.php" class="style10">Home</a> <span class="style4">|</span> <a href="buy.php" class="style46">Buy</a> <span class="style4">|</span><a href="sell.php" class="style46"> Sell </a><span class="style4">| </span><span class="style9"><a href="search.php" class="style46">Search</a> <span class="style44">|</span> <a href="help.php" class="style46">Help</a> </span></div></td>
  </tr>
  <tr>
    <td height="226" bgcolor="#F1F5FA" class="top left" onClick="goto('buy.php');"><div align="center"><img src="images/buy.gif" alt="Petoskey Classifieds Listings" width="272" height="178" /></div></td>
    <td bgcolor="#E2ECF5" class="top right" onClick="goto('sell.php');"><div align="center"><img src="images/sell.gif" alt="Petoskey Classifieds Sell Items" width="265" height="180" /></div></td>
  </tr>
  <tr>
    <td height="34" colspan="2" valign="top" class="main-content"><br />
    <table width="100%" height="75" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="71%" valign="top" class="left-content"><table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                <td valign="bottom"><span class="style34">Contact Classified Owner </span></td>
                <td width="180" valign="bottom" style="padding-right:5px;"><div align="right"><img src="images/sort.gif" width="80" height="24" /></div></td>
              </tr>
            </tbody>
            </table>
            
            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #D8D8D8;" class="listings">
              <tr>
                <td height="30" colspan="2" valign="middle" bgcolor="#E2ECF5" style="padding-left:10px;" class="pages"></td>
              </tr>
              <tr>
                <td height="30" colspan="2" valign="middle" bgcolor="#EFF4FA" style="padding-left:10px;" class="pages">
				<?PHP
				$i = $_GET['id'];
				$back = "SELECT * FROM classifieds WHERE adid = '$i' limit 1";
$query2 = mysql_query($back) or die (mysql_error());
while($row = mysql_fetch_array($query2, MYSQL_ASSOC)){
$title = $row['title'];
$id = $row['adid'];
}
				?>
				
				<form action="contact.php" method="get">
				<input type="hidden" name="id" value="<?PHP echo $id; ?>" />
				<table width="100%" border="0" cellspacing="7" cellpadding="0">
                  <tr>
                    <td><div align="right" class="style52">Contacting Owner Of Ad: </div></td>
                    <td style="padding-left:10px;"><span class="style52"><?PHP echo $title." (".$id.")"; ?></span> </td>
                  </tr>
                  <tr>
                    <td width="45%"><div align="right" class="style52">Your Name </div></td>
                    <td width="55%" style="padding-left:10px;"><div align="left">
                      <input type="text" name="name" />
                    </div></td>
                  </tr>
                  <tr>
                    <td><div align="right" class="style52">Your Email </div></td>
                    <td style="padding-left:10px;"><div align="left">
                      <input type="text" name="email" />
                    </div></td>
                  </tr>
                  <tr>
                    <td><div align="right" class="style52">Subject</div></td>
                    <td style="padding-left:10px;"><div align="left">
                      <input type="text" name="subject" />
                    </div></td>
                  </tr>
                  <tr>
                    <td><div align="right" class="style52">Message</div></td>
                    <td style="padding-left:10px;"><div align="left">
                      <textarea name="body" rows="5"></textarea>
                    </div></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td style="padding-left:10px;"><input type="submit" name="submit" value="Contact Seller" /></td>
                  </tr>
                </table>
                </form></td>
              </tr>

              <tr>
                <td height="23" bgcolor="#E2ECF5" colspan="3"><div align="center">
                  <table width="185" border="0" align="right" cellpadding="0" cellspacing="3">
                    <tr>
                      <td colspan="2"><div align="center" class="style26">
                        <div align="right"></div>
                      </div></td>
                      </tr>
                    </table>
                </div></td>
              </tr>
            </table>
            <br />
          <br /></td>
          <td width="29%" valign="top" class="right-content"><?PHP include("inc/right.php"); ?></td>
        </tr>
    </table>    </td></tr>
  <tr>
    <td height="93" colspan="2" valign="top" class="footer">
    <div style="float:right;"><a href="#"><img src="images/backtotop.png" width="59" height="18" border="0" /></a></div>
    <div align="left" class="style23">
      <p><span class="style23"><a href="index.php" class="style49">Home</a> <span class="style44">|</span> <a href="buy.php" class="style49">Buy</a> <span class="style44">|</span><a href="sell.php" class="style49"> Sell </a><span class="style44">| </span><span class="style49"><a href="search.php" class="style49">Search</a> <span class="style44">|</span> <a href="help.php" class="style49">Help</a></span></span></p>
      <p class="style24"> All Rights Reserved 
        <?PHP include("inc/title.php"); ?>
        <br />
      PHP Classifieds App - <a href="http://www.rcoders.com/" style="text-decoration:none;color:#000000;">RCoders</a> Dev </p>
    </div></td>
  </tr>
</table>
</body>
</html>
<?PHP 
}
}?>
Return current item: PHP Classified script made easy