01-24-2012, 09:36 AM
01-24-2012, 04:46 PM
For my contact page on my website, I have an integrated captcha as well from a font that I use directly through my site files and generated in PHP. So a bit more advanced than this, but I can't see what's wrong here, i'm sure it's one of those small things that makes you look absolutely stupid when you finally realize what you were doing wrong lol. I don't like when that happens to me.
01-25-2012, 03:21 AM
(01-24-2012, 09:36 AM)Laugh Wrote: [ -> ]Crystal you're clearly doing something wrong, we cannot figure that out for you. Start over and do what I said exactly.
Did that but still the same :\
(01-24-2012, 04:46 PM)AceInfinity Wrote: [ -> ]For my contact page on my website, I have an integrated captcha as well from a font that I use directly through my site files and generated in PHP. So a bit more advanced than this, but I can't see what's wrong here, i'm sure it's one of those small things that makes you look absolutely stupid when you finally realize what you were doing wrong lol. I don't like when that happens to me.
I know I hate it (
01-25-2012, 04:00 PM
Just a FYI, you don't need to change the HTML extension to PHP to call the script..
http://php.about.com/od/advancedphp/p/html_php.htm
http://php.about.com/od/advancedphp/p/html_php.htm
01-25-2012, 05:51 PM
(01-25-2012, 04:00 PM)Pompano Wrote: [ -> ]Just a FYI, you don't need to change the HTML extension to PHP to call the script..
http://php.about.com/od/advancedphp/p/html_php.htm
What's the point of that though if it takes a php line as an indicator before things get parsed before being sent to the browser anyway though? Unless he has current SEO and pages backlinked to that contact page, (which I doubt it as he's only began the site recently from what I can tell), it's much better to just rename the extensions from the start. Much more proper and better habit. And also doesn't require and htaccess modification, so you can save that file for necessary things.
That link points to the fact that if you have any php code that you might need to add to an existing plain html file later on down the road after you've already gained backlinks and SEO with that particular filename with it's html file extension, a method to keep the html file extension while having optionality to use PHP. His/her case here is not related to anything where that would be required though.
MUCH safer as well I might assume, since it gets parsed as soon as it recognizes the file extension, instead of opening the file first before recognizing the data that has to be parsed as PHP. Plus it reduces the base code on the actual file uploaded to your site if your concerned with a few milliseconds of page load time which can possibly save bandwidth over a longer timespan.
05-23-2013, 04:23 PM
(01-22-2012, 09:20 PM)Peter L Wrote: [ -> ]You need to use PHP. Try these codes:
Incorporate this in your page;
HTML:Spoiler (Click to View)Code:<form name="contactform" method="post" action="send_form_email.php">
<table width="450px">
<tr>
<td valign="top">
<label for="first_name">First Name *</label>
</td>
<td valign="top">
<input type="text" name="first_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top"">
<label for="last_name">Last Name *</label>
</td>
<td valign="top">
<input type="text" name="last_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email Address *</label>
</td>
<td valign="top">
<input type="text" name="email" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="telephone">Telephone Number</label>
</td>
<td valign="top">
<input type="text" name="telephone" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="comments">Comments *</label>
</td>
<td valign="top">
<textarea name="comments" maxlength="1000" cols="25" rows="6"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
This below must be named 'send_form_email.php'
You must edit 2 lines for yourself (email and subject)
PHP:
Spoiler (Click to View)PHP Code:<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "YOUREMAIL@HERE.COM";
$email_subject = "Subject";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
<?php
}
?>
Hello,
It is working 100% with me
Thanks alot for your support.
Just one thing:
when I received the email & reviwe it via outlook, the message aling text from right to left,
Please advise me: how to make the message aling text from Left to right?
Thanks in advance.
05-24-2013, 05:51 PM
You need a home server, install xampp or wamp.