Reputation Activity
-
Timo got a reaction from trolorbeddect in Simple PHP redirect after submitting a formI'm not familiar with scripting or server-side handling of forms as I only know HTML and CSS, so I have temporarily opted to use a free PHP form:-
http://www.freecontactform.com/email_form.php
The PHP code is as follows:
<?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "you@yourdomain.com"; $email_subject = "Your email subject line"; 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 --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?>
Where it says:
"<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon."
Is it possible to redirect it to load a new HTML ThankYou page after the email is submitted instead, rather than using inline HTML inside the PHP file?
Thanks
-
Timo reacted to webdeveloper93 in Simple PHP redirect after submitting a formyou can use a php redirect
header("Location:thankyou.html"); exit; -
Timo reacted to Mr Ben in Simple PHP redirect after submitting a formHave you tried something like this:
<?php
header( 'Location: http://www.WEBSITE/PAGE HERE' ) ;
?>
-
Timo reacted to andy9l in Simple PHP redirect after submitting a formTry this:
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "you@yourdomain.com";
$email_subject = "Your email subject line";
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();
if (@mail($email_to, $email_subject, $email_message, $headers)){
header("Location:thankyou.html");
} else {
header("Location:error.html");
}
exit;
}
?>You'll need a thankyou.html page and a error.html page (if the mail fails to send...although unlikely). -
Timo reacted to Leonvv in Simple animated dropdown menu confusionYour CSS and jQuery are getting in each others way.
This CSS makes your dropdown list visible:
#menu li:hover ul { display: block; }
While this jQuery is toggling him away again:
.stop(true, true).slideToggle('fast');
Try removing the CSS ( just the line at the top of my post ) and it will probably work.
Léon
-
Timo reacted to evu in How to make an screenshot effect like this...?Not the best at photoshop but had a quick go.
Hard to get the exact angle... You need:
A pattern that's akin to a monitor screen. Try Googling "Scanlines in Photoshop".
A rainbow gradient with about 10% opacity to create the other monitor RGB effect.
Transform the screenshot, the only hard bit to get perfect.
Duplicate screenshot layer and apply a gaussian blur to it, then a mask and mask out the bits you don't want blured.
Here's a psd to gander on.
Goodluck,
~evu.
-
Timo reacted to Dizi in What on Earth am I doing wrong?your code is a bit all over the place and its not really the best way to construct a menu, here is a better way of doing it:
menu html:
<ul id="menubar"> <li><a href="#">button 1 </a></li> <li><a href="#">button 2</a></li> <li><a href="#">button 3</a></li> <li><a href="#"> button 4</a></li> </ul>
menu css:
ul#menubar { height: 23px; width: 728px; margin-left: 2px; margin-top: 2px; float: left; } ul#menubar li { float:left; list-style:none; width: 181px; } ul#menubar li a { height: 23px; width:181px; display:block; text-align:center; line-height:23px; background-image:url(images/menu-button.png); color:#FFFFFF; text-decoration:none; } ul#menubar li a:hover { background-image:url(images/menu-button-hover.png ) }
basically the idea is to use elements to create the menu style through css, instead of adding divs and absolute positioning text ontop of images. + no need for javascript to change the hover state of the image
Although the above will cause a flicker when going from one image to the other in hover state, but you can fix that by following this tutorial:
http://www.webdesignerforum.co.uk/topic/3420-css-change-img-on-hover/page__view__findpost__p__21844
Hope this helps