Jump to content

jarvis

Members
  • Posts

    543
  • Joined

  • Last visited

Posts posted by jarvis

  1. Hi All,

     

    I've got the following URL:

    http://www.mydomain.com?ec3_after=2010-07-21&ec3_before=2010-07-22

     

    This then returns a list of results after todays date but before 7 days time.

     

    Unfortunately, this is hard coded and I'd like to make it dynamic. How the hell can I get todays date and pass it into the above? Was thinking something like:

    
    $start_today = date('Y m d');
    $end_date = '';
    http://www.mydomain.com?ec3_after=<?php echo $start_date; ?>&ec3_before=<?php echo $end_date; ?>&
    

    However, I can't work out how to add the - in the date. I also can't work out how to add 7 days, adding 7 wont work as you need to know which month as to which date the month ends on.

     

    Any help is much appreciated!

     

    Many thanks in advanced!

  2. Hi All,

     

    Building a site with wordpress and want to show which page your on with the nav, as such the following code works:

    	<?php
    foreach(get_pages('childof=0') as $p) {
      if($p->post_parent == 0) {
        $lc = ($p->ID == $wp_query->post->ID) ? ' class="active"' : '';
    	echo '<li><a href="'.get_permalink($p->ID).'" title="'.$p->post_title.'"'.$lc.'>'.$p->post_title.'</a></li>';
      }
    }
    ?>	

    Problem is, it's stopped the page order plug in I use working and just lists the pages automatically in alphabetical order. Is there any way I can alter the above to stop this?

     

    Thanks

  3. Ok using your sql worked, however, I need to use it as a replacement to the below:

    $images_query = 'SELECT categories.category_id, categories.category, thumbs.file_name, thumbs.image_description, uploads.file_name, uploads.image_description FROM (categories INNER JOIN thumbs ON categories.category_id = thumbs.category_id) INNER JOIN uploads ON thumbs.thumb_id = uploads.upload_id WHERE categories.category_id = '.$row['category_id'];
    

    As soon as I try adding in the category id part, it bombs the query with the error above????

    thanks

  4. Thanks DavidAM, if i use

    SELECT thumbs.thumb_id, thumbs.file_name, uploads.upload_id, uploads.file_name 
    FROM thumbs JOIN uploads on thumb_id = upload_id
    WHERE categories.category_id =19
    

    I get the following error

    Unknown column 'categories.category_id' in 'field list'

     

    have I used your query incorrectly?

    Thanks

  5. Hi all,

     

    Hope someone can help. I've got the following query but it's returning the wrong result!

    Code:

    SELECT categories.category_id, categories.category, thumbs.file_name, thumbs.image_description, uploads.file_name, uploads.image_description 
    FROM ( 
    categories 
    INNER JOIN thumbs ON categories.category_id = thumbs.category_id 
    ) 
    INNER JOIN uploads ON thumbs.thumb_id = uploads.upload_id 
    WHERE categories.category_id =19 
    

     

    Although the above query works, the file_name is incorrect. It's pulling the right name for the thumbs.filename but not for uploads.file_name, this leads me to think it's the wau the uploads table is joined but I cannot see for looking!

     

    I have 4 tables

    Categories

    Code:

    CREATE TABLE IF NOT EXISTS `categories` ( 
      `category_id` tinyint(3) unsigned NOT NULL auto_increment, 
      `category` varchar(255) collate latin1_german2_ci NOT NULL default '', 
      `cat_type` enum('0','1') collate latin1_german2_ci NOT NULL default '0', 
      PRIMARY KEY  (`category_id`) 
    ) 
    

    Category associations

    Code:

    CREATE TABLE IF NOT EXISTS `category_associations` ( 
      `ca_id` smallint(4) unsigned NOT NULL auto_increment, 
      `upload_id` tinyint(3) unsigned NOT NULL default '0', 
      `category_id` tinyint(3) unsigned NOT NULL default '0', 
      `date_submitted` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, 
      `approved` char(1) collate latin1_german2_ci NOT NULL default 'N', 
      PRIMARY KEY  (`ca_id`) 
    ) 
    

    Thumbs

    Code:

    CREATE TABLE IF NOT EXISTS `thumbs` ( 
      `thumb_id` int(10) unsigned NOT NULL auto_increment, 
      `category_id` int(10) unsigned NOT NULL default '0', 
      `file_name` varchar(255) collate latin1_german2_ci NOT NULL default '', 
      `file_size` int(6) unsigned NOT NULL default '0', 
      `file_type` varchar(30) collate latin1_german2_ci NOT NULL default '', 
      `image_description` varchar(255) collate latin1_german2_ci default NULL, 
      `date_entered` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, 
      PRIMARY KEY  (`thumb_id`), 
      KEY `file_name` (`file_name`), 
      KEY `date_entered` (`date_entered`) 
    ) 
    

    Uploads

    Code:

    CREATE TABLE IF NOT EXISTS `uploads` ( 
      `upload_id` int(10) unsigned NOT NULL auto_increment, 
      `category_id` int(10) unsigned NOT NULL default '0', 
      `file_name` varchar(255) collate latin1_german2_ci NOT NULL default '', 
      `file_size` int(6) unsigned NOT NULL default '0', 
      `file_type` varchar(30) collate latin1_german2_ci NOT NULL default '', 
      `image_description` varchar(255) collate latin1_german2_ci default NULL, 
      `date_entered` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, 
      PRIMARY KEY  (`upload_id`), 
      KEY `file_name` (`file_name`), 
      KEY `date_entered` (`date_entered`) 
    ) 
    

     

     

    A form is filled in, uploading a thumb and main image to a set category. The form handles multiple uploads. however, the query at the top seems wrong. Any ideas?

     

    TIA

     

  6. Hi PFMaBiSmAd,

    Because of the way the site was constructed, I thought this would be the best way. The structure is:

    Header

    Page name, for example, index, about, thanks etc (which has several includes 1 being the enquiry form)

    Footer

     

    The enquiry form says thank you once you submit it, however, it would be better to fill in the form and send them to the thanks page. I thought header() was the only option to do this. If there is another way, I'm all ears! However, as this is a live site, I don't want to recode pages

  7. Thanks for the replies, the error says:

     

    Warning: Cannot modify header information - headers already sent by (output started at \inc\header.php:139) in \inc\quick_enquiry_form2.php on line 44

     

    Line 139 in header.php is the navigation and line 44 of quick_enquiry_form2.php has no spacing and looks like

    [php      $mailResult = @mail($to, $subject, $message, $headers);

          if (!$mailResult) { die("Mail Error: $php_errormsg"); }

      header("Location:thanks.php");[/code]

    There are also no spaces at the top of that file.

     

    Sorry, someone is gonna have to speak & spell it to me! :-(

  8. Hi All,

     

    The following code is an include on my site. What I'm after is a redirect, using headers is the best & quickest method, however, whenever I try this, I get the damned headers sent message. Is this because it's an include file? here's my code:

    <?php require_once "/lib/viewer_functions.php";
    
      // process form
      if (@$_REQUEST['submitForm']) {
    
        // error checking
        $errorsAndAlerts = "";
    $check = $_REQUEST['check'];
    $randomNumber = $_REQUEST['randomNumber'];
        if (!@$_REQUEST['name'])                	{ $errorsAndAlerts = "Please add your name\n"; }
        if (!@$_REQUEST['email'])                   { $errorsAndAlerts = "Please add your email\n"; }
        else if(!isValidEmail(@$_REQUEST['email'])) { $errorsAndAlerts = "That email address is not valid\n"; }
        if (!@$_REQUEST['enquiry'])                 { $errorsAndAlerts = "Please add your enquiry\n"; }
    if (!@$_REQUEST['randomNumber'])          	{ $errorsAndAlerts = "Please verify the number\n"; }
    
    $textToConvert = $_REQUEST['enquiry'];
    $convertedText = iconv("UTF-8", "ISO-8859-1", $textToConvert);
    
        // send email user
        if ((!$errorsAndAlerts) && ($randomNumber == $check)) {
          $to      = "info@domain.com";	
          $subject = "Quick Contact";
      $email    = "info@domain.com";
    
      $headers  = "MIME-Version: 1.0\r\n";
      $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
      $headers .= "From: $email \r\n";
      
      $body =  "<strong>Full name</strong>: ". $_REQUEST['name'] ."<br />";
      $body .= "<strong>Email</strong>: ".$_REQUEST['email'] ."<br />";
      $body .= "<strong>Enquiry</strong>: $convertedText<br /><br />";
      $body .= "The user who sent this message had the IP address <strong>".$_SERVER['REMOTE_ADDR']."</strong><br />";
    
      $message = $body;	  
    
          // send message
          $mailResult = @mail($to, $subject, $message, $headers);
          if (!$mailResult) { die("Mail Error: $php_errormsg"); }
    
          //
          //$errorsAndAlerts = "Thanks!  We've sent your email.";
    header("Location: /thanks.php"); exit();
          $_REQUEST = array(); // clear form values
    
    }
    
      }
    
    ?>
    <?php $randomNumber = rand(1,10); ?> 
    <!-- right quick_contact form -->
    
    <!-- quick_contact_title -->
    <div class="rh_quick_contact_title">
    	<img src="images/rh_quick_enquiry_title.jpg" width="232" height="31" />
    </div>
    <!-- /quick_contact_title -->		
    
    
    <!-- quick_contact_form -->
    <div class="rh_quick_contact_content_larger">
    <form method="post">
    	<input type="hidden" name="submitForm" value="1" />
    
    	<?php if (@$errorsAndAlerts): ?>
    		<div style="color: red; font-weight: bold; font-size: 12px; font-family: arial;">
    		  <?php echo $errorsAndAlerts; ?>
    		</div>
    	 <?php endif ?>
    
    	<table width="213" border="0" cellpadding="2" cellspacing="2">
    		<tr>
    			<td align="center">
    				<input name="name" type="text" id="name" style="width:180px;" value="Name..." onclick="clickclear(this, 'Name...')" onblur="clickrecall(this,'Name...')" />
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
    				<input name="email" type="text" id="email" style="width:180px;" value="Email Address..." onclick="clickclear(this, 'Email Address...')" onblur="clickrecall(this,'Email Address...')"/>
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
    				<textarea name="enquiry" id="enquiry" value="Enquiry..." onclick="clickclear(this, 'Enquiry...')" onblur="clickrecall(this,'Enquiry...')" style="width:180px;" rows="3"></textarea>
    			</td>
    		</tr>	
    		<tr>
    			<td align="center"><input type="text" id="randomNumber" name="randomNumber" style="width:20px;" /> Please enter the following number in the left hand box: <?php echo $randomNumber; ?>
    	</td>
    		</tr>				
    		<tr>
    			<td><div align="right">
    				<input type="image" src="images/blue_submit_button.jpg" value="Submit" alt="Submit">  
    			</div></td>
    		</tr>										
    	</table>	
    <input type="hidden" id="check" name="check" value="<?php echo $randomNumber;?>" />
    </form>
    </div>
    <!-- /quick_contact_form -->

     

    As always, any help is much appreciated!

    Thanks

  9. Hi roopurt18

     

    I'll alter those now. It's code i've inherited, I'm just adding to it.

     

    is there anyway I can redirect the user after the form is complete with correct info? Can only think of header() but the above is an include on a page so gives the headers sent error

     

    Thanks

  10. Thanks all, I think I've now got it working. Albeit an undefined warning message. Here's my final code:

      if (@$_REQUEST['submitForm']) {
    
        // error checking
        $errorsAndAlerts = "";
    $check = $_REQUEST['check'];
    $randomNumber = $_REQUEST['randomNumber'];
        if (!@$_REQUEST['name'])                	{ $errorsAndAlerts = "Please add your name\n"; }
        if (!@$_REQUEST['email'])                   { $errorsAndAlerts = "Please add your email\n"; }
        else if(!isValidEmail(@$_REQUEST['email'])) { $errorsAndAlerts = "That email address is not valid\n"; }
        if (!@$_REQUEST['enquiry'])                 { $errorsAndAlerts = "Please add your enquiry\n"; }
        if (!@$_REQUEST['randomNumber'])          	{ $errorsAndAlerts = "Please verify the number\n"; }
    
    $textToConvert = $_REQUEST['enquiry'];
    $convertedText = iconv("UTF-8", "ISO-8859-1", $textToConvert);
    
        // send email user
        if ((!$errorsAndAlerts) && ($randomNumber == $check)) {
          $to      = "info@domain.co.uk";		
          $subject = "Quick Contact";
          $email    = $_REQUEST['email'];
    
    
      $headers  = "MIME-Version: 1.0\r\n";
      $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
      #$headers .= "Content-Type: text/html; charset=utf8\r\n";
      $headers .= "From: $email \r\n";
      
      $body =  "<strong>Full name</strong>: ". $_REQUEST['name'] ."<br />";
      $body .= "<strong>Email</strong>: ".$_REQUEST['email'] ."<br />";
      $body .= "<strong>Enquiry</strong>: $convertedText<br /><br />";
      $body .= "The user who sent this message had the IP address <strong>".$_SERVER['REMOTE_ADDR']."</strong><br />";
    
      $message = $body;	  
    
          // send message
          $mailResult = @mail($to, $subject, $message, $headers);
          if (!$mailResult) { die("Mail Error: $php_errormsg"); }
    
          //
          $errorsAndAlerts = "Thanks!  We've sent your email.";
          $_REQUEST = array(); // clear form values
        }
    
      }
    
    ?>
    <?php $randomNumber = rand(1,10); ?> 
    <!-- right quick_contact form -->
    
    <!-- quick_contact_title -->
    <div class="rh_quick_contact_title">
    	<img src="images/rh_quick_enquiry_title.jpg" width="232" height="31" />
    </div>
    <!-- /quick_contact_title -->		
    
    
    <!-- quick_contact_form -->
    <div class="rh_quick_contact_content">
    <form method="post">
    	<input type="hidden" name="submitForm" value="1" />
    
    	<?php if (@$errorsAndAlerts): ?>
    		<div style="color: red; font-weight: bold; font-size: 12px; font-family: arial;">
    		  <?php echo $errorsAndAlerts; ?>
    		</div>
    	 <?php endif ?>
    
    	<table width="213" border="0" cellpadding="2" cellspacing="2">
    		<tr>
    			<td align="center">
    				<input name="name" type="text" id="name" style="width:180px;" value="Name..." onclick="clickclear(this, 'Name...')" onblur="clickrecall(this,'Name...')" />
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
    				<input name="email" type="text" id="email" style="width:180px;" value="Email Address..." onclick="clickclear(this, 'Email Address...')" onblur="clickrecall(this,'Email Address...')"/>
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
    				<textarea name="enquiry" id="enquiry" value="Enquiry..." onclick="clickclear(this, 'Enquiry...')" onblur="clickrecall(this,'Enquiry...')" style="width:180px;" rows="3"></textarea>
    			</td>
    		</tr>	
    		<tr>
    			<td><?php echo $randomNumber; ?> <input type="text" id="randomNumber" name="randomNumber" style="width:20px;" /> Please enter the number
    	</td>
    		</tr>				
    		<tr>
    			<td><div align="right">
    				<input type="image" src="images/blue_submit_button.jpg" value="Submit" alt="Submit">  
    			</div></td>
    		</tr>										
    	</table>	
    <input type="hidden" id="check" name="check" value="<?php echo $randomNumber;?>" />
    </form>
    

     

    Thank you all for your help. I think that's everything I need!?!?!

  11. I'd like to try this without sessions but think I've not grasped meltingpoint's method

    <?php
      // process form
      if (@$_REQUEST['submitForm']) {
    
        // error checking
        $errorsAndAlerts = "";
        if (!@$_REQUEST['quick_enquiry_name']) { $errorsAndAlerts = "No name\n"; } 
    if (!@$_REQUEST['number'])             { $errorsAndAlerts = "Add a number\n"; } 
    
    $test = $_REQUEST['test'];
    echo $test;
    
    if (($_REQUEST['number']) == $test) {		
    	echo 'match';	
    }else{		
    	echo 'no';	
    }
      }
    
    ?>
    <?php $number = rand(1,10); ?> 
    <!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>
    <title>Quick Enquiry Confirmation</title>
    </head>
    <body>
    <form method="post">
    <?php if (@$errorsAndAlerts): ?>
    <div style="color: red; font-weight: bold; font-size: 12px; font-family: arial;">
      <?php echo $errorsAndAlerts; ?>
    </div>
    <?php endif ?>		
    
    <?php echo $number; ?>
    <table width="213" border="0" cellpadding="2" cellspacing="2">	
    <tr>
    	<td colspan="2">
    	<input name="quick_enquiry_name" type="text" id="quick_enquiry_name" style="width:180px;" value="Name..." onclick="clickclear(this, 'Name...')" onblur="clickrecall(this,'Name...')" />
    
    	<input type="text" id="number" name="number" style="width:180px;" />
    	<input type="hidden" id="test" value="<?php echo $number;?>" style="width:180px;" />
    	</td>
    </tr>							
    <tr>
    	<td><div align="right">
    		<input type="image" src="images/blue_submit_button.jpg" value="Submit" alt="Submit" />  
    	</div></td>
    </tr>									
    </table>	
    <input type="hidden" name="submitForm" value="1" />	
    </form>
    

    Thanks

  12. Hi all, thanks for the replies.

    Ok, in rough format (until i get it working). This is my code:

    <?php session_start(); ?>
    <?php
      // process form
      if (@$_REQUEST['submitForm']) {
    
        // error checking
        $errorsAndAlerts = "";
        if (!@$_REQUEST['quick_enquiry_name']) { $errorsAndAlerts = "No name\n"; } 
    if (!@$_REQUEST['number'])             { $errorsAndAlerts = "Add a number\n"; } 
    
    $_SESSION['number'] = rand(1, 10);
    if ($_REQUEST['number'] == $_SESSION['number']) {  
    echo 'yay';
    }else {  
    echo 'no';
    }
    
      }
    
    ?>
    <?php $number = rand(1,10); ?> 
    <!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>
    <title>Quick Enquiry Confirmation</title>
    </head>
    <body>
    <form method="post">
    <?php if (@$errorsAndAlerts): ?>
    <div style="color: red; font-weight: bold; font-size: 12px; font-family: arial;">
      <?php echo $errorsAndAlerts; ?>
    </div>
    <?php endif ?>		
    
    <?php echo $number; ?>
    <table width="213" border="0" cellpadding="2" cellspacing="2">	
    <tr>
    	<td colspan="2">
    	<input name="quick_enquiry_name" type="text" id="quick_enquiry_name" style="width:180px;" value="Name..." onclick="clickclear(this, 'Name...')" onblur="clickrecall(this,'Name...')" />
    
    	<input type="text" id="number" name="number" style="width:180px;" />
    	</td>
    </tr>							
    <tr>
    	<td><div align="right">
    		<input type="image" src="images/blue_submit_button.jpg" value="Submit" alt="Submit" />  
    	</div></td>
    </tr>									
    </table>	
    <input type="hidden" name="submitForm" value="1" />	
    </form>
    

    However, it works sometimes and not others!

     

    Grrr....

     

    Something so simple can take sooooo much time!

  13. Hi,

     

    I a daft question. I use

    <?php $number = rand(1,10); ?> 

    to generate a random number between 1 & 10

     

    I then show that using

    <?php echo $number; ?>

     

    Why is it that if this is a simple form, when you submit it this doesn't work. It always returns no rather than match, whether you enter the same numer in the form or not! ARGHHHHHH!  :'(

    	if (($_REQUEST['number']) == $number) {
    	echo 'match';
    }else{
    	echo 'no';
    }
    

     

    Guessing it's easy & im being daft!

     

    Thanks

  14. Hi All,

     

    Probably very simple but can't work it out. I've the following form

    <form method="post" action="sendEmail.php">
    <?php if (@$errorsAndAlerts): ?>
    <div style="color: red; font-weight: bold; font-size: 12px; font-family: arial;">
      <?php echo $errorsAndAlerts; ?>
    </div>
    <?php endif ?>		 
    <table width="213" border="0" cellpadding="2" cellspacing="2">	
    <tr>
    	<td colspan="2">
    	Please enter the words below (anti-spam)<br />
    	<?php echo recaptcha_get_html($publickey, @$captchaError); ?>
    	</td>
    </tr>							
    <tr>
    	<td><div align="right">
    		<input type="image" src="images/blue_submit_button.jpg" value="Submit" alt="Submit">  
    	</div></td>
    </tr>									
    </table>	
    <input type="hidden" name="submitForm" value="1" />
    <input type="hidden" name="quick_enquiry_name" value="<?php echo htmlspecialchars($_POST['quick_enquiry_name']); ?>" />
    <input type="hidden" name="quick_enquiry_email" value="<?php echo htmlspecialchars($_POST['quick_enquiry_email']); ?>" />
    <input type="hidden" name="enquiry" value="<?php echo htmlspecialchars($_POST['enquiry']); ?>" />		
    </form>
    

    Some values a past in from a previous form.

     

    What I'm trying to do, is the above form has a recaptcha, sO I need to verify the input from here first, if it's ok, then process the form which sends an email using sendEmail.php. My validation is below:

    <?php
    
      
    // Get a key from http://recaptcha.net/api/getkey
    require_once('recaptchalib_comments.php');
    if (preg_match("/domain.com/", $_SERVER['HTTP_HOST'])) {
    	$publickey  = "";
    	$privatekey = "";
    }
    else if (preg_match("/domain.co.uk/", $_SERVER['HTTP_HOST'])) {
    	$publickey  = "";
    	$privatekey = "";
    }  
    
      if (@$_REQUEST['submitForm']) {
      $errorsAndAlerts = "";
      
    if (!@$_REQUEST['recaptcha_response_field']) { $errorsAndAlerts .= "Please enter the two words displayed (this is to stop spam).<br/>"; }
        if (@$_REQUEST['recaptcha_response_field']) {
        $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if (!$resp->is_valid) { $errorsAndAlerts .= "Incorrect value for anti-spam validation, please try again.<br/>"; }
        $captchaError = $resp->error;
      	}	  
      
      }
    
    ?>
    

    At the moment, blank fields in my recaptcha or the wrong words still process the form & therefore email as I can't work out how to test the form first.

     

    Any help is much appreciated!

  15. Thanks, although I'm not sure how I would do it with my code:

    <?php
    
    
      // process form
      if (@$_REQUEST['submitForm']) {
    
        // error checking
        $errorsAndAlerts = "";
        if (!@$_REQUEST['name'])                	{ $errorsAndAlerts = "Please fill out all fields\n"; }
        if (!@$_REQUEST['email'])                   { $errorsAndAlerts = "Please fill out all fields\n"; }
        else if(!isValidEmail(@$_REQUEST['email'])) { $errorsAndAlerts = "That email address is not valid\n"; }
        if (!@$_REQUEST['enquiry'])                 { $errorsAndAlerts = "Please fill out all fields\n"; }
    
    $textToConvert = $_REQUEST['enquiry'];
    $convertedText = iconv("UTF-8", "ISO-8859-1", $textToConvert);
    
        // send email user
        if (!$errorsAndAlerts) {
      $to      = "info@domain.co.uk";		
          $subject = "Quick Contact";
          $email    = $_REQUEST['email'];
    
      $headers  = "MIME-Version: 1.0\r\n";
      $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
      #$headers .= "Content-Type: text/html; charset=utf8\r\n";
      $headers .= "From: $email \r\n";
      
      $body =  "<strong>Full name</strong>: ". $_REQUEST['name'] ."<br />";
      $body .= "<strong>Email</strong>: ".$_REQUEST['email'] ."<br />";
      $body .= "<strong>Enquiry</strong>: $convertedText<br /><br />";
      $body .= "The user who sent this message had the IP address <strong>".$_SERVER['REMOTE_ADDR']."</strong><br />";
    
      $message = $body;	  
    
          // Note: The above line must be flush left or you'll get an error
          // This is a PHP heredoc.  See: http://ca2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
    
          // send message
          $mailResult = @mail($to, $subject, $message, $headers);
          if (!$mailResult) { die("Mail Error: $php_errormsg"); }
    
          //
          $errorsAndAlerts = "Thanks!  We've sent your email.";
          $_REQUEST = array(); // clear form values
        }
    
      }
    
    ?>
    
    <!-- right quick_contact form -->
    
    <!-- quick_contact_title -->
    <div class="rh_quick_contact_title">
    	<img src="images/rh_quick_enquiry_title.jpg" width="232" height="31" />
    </div>
    <!-- /quick_contact_title -->		
    
    
    <!-- quick_contact_form -->
    <div class="rh_quick_contact_content">
    <form method="post">
    	<input type="hidden" name="submitForm" value="1" />
    
    	<?php if (@$errorsAndAlerts): ?>
    		<div style="color: red; font-weight: bold; font-size: 12px; font-family: arial;">
    		  <?php echo $errorsAndAlerts; ?>
    		</div>
    	 <?php endif ?>
    
    	<table width="213" border="0" cellpadding="2" cellspacing="2">
    		<tr>
    			<td align="center">
    				<input name="name" type="text" id="name" style="width:180px;" value="Name..." onclick="clickclear(this, 'Name...')" onblur="clickrecall(this,'Name...')" />
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
    				<input name="email" type="text" id="email" style="width:180px;" value="Email Address..." onclick="clickclear(this, 'Email Address...')" onblur="clickrecall(this,'Email Address...')"/>
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
    				<textarea name="enquiry" id="enquiry" value="Enquiry..." onclick="clickclear(this, 'Enquiry...')" onblur="clickrecall(this,'Enquiry...')" style="width:180px;" rows="4"></textarea>
    			</td>
    		</tr>					
    		<tr>
    			<td><div align="right">
    				<input type="image" src="images/blue_submit_button.jpg" value="Submit" alt="Submit">  
    			</div></td>
    		</tr>										
    	</table>	
    </form>
    </div>
    <!-- /quick_contact_form -->
    

    Any pointers are most gratefully received!

  16. Hi All,

     

    Prob very simple but here goes. I've a form on a page, which needs a recaptcha field, due to design constraints however, it won't fit.

     

    I therefore need it so you fill in the form, click submit, a new window appears with the recaptcha field and a confirmation button. Once you click confirm, the form is processed and the email sent.

     

    What's the best way to do this please? The form script has the PHP to handle the emailing side.

  17. Ok, I've altered my code and this should be correct, however, the encoding still isn't working. Here's my code:

        if (!$errorsAndAlerts) {
          $email    = $_REQUEST['email'];
          $to      = "info@domain.com";
          $subject = "Quick Contact";
    
    
    $body =  "Full name: ". $_REQUEST['name'] ."\n\n";
    $body .= "Email: ".$_REQUEST['email'] ."\n\n";
    $body .= "Enquiry: ".  $_REQUEST['enquiry'] ."\n\n";
    $body .= "The user who sent this message had the IP address ".$_SERVER['REMOTE_ADDR']."\n\n";
    
    $message = $body;
    
    $headers  = "MIME-Version: 1.0\r\n";		#html hdr
    $headers .= "Content-Type: text/html; charset=utf8\r\n";
    $headers .= "From: $email \r\n";		#from
    
          // send message
          $mailResult = @mail($to, $subject, $message, $headers);
          if (!$mailResult) { die("Mail Error: $php_errormsg"); }
    

    I cannot see where I'm going wrong!

    Thanks

×
×
  • 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.