-
-
-
-
- Simple PHP redirect after submitting a form
- Simple PHP redirect after submitting a form
-
Simple PHP redirect after submitting a form
I'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
-
Mouse-click animated particle effect
I wish to emulate a subtle animated particle effect on mouse click, similar to that on: http://www.flowerdesign.co.uk but with my own little image sprites. The above site is based on flash, which I want to avoid. I wondered if there were any similar mouse-click scripts out there for JQuery or similar that anyone may know of? Thank you.
-
Mouse-click animated effect
I wish to emulate a subtle animated effect on mouse click, similar to that on: http://www.flowerdesign.co.uk but with my own little image sprites. The above site is based on flash, which I want to avoid. I wondered if there were any similar mouse-click scripts out there for JQuery or similar that anyone may know of? Thank you.
- this is a nice quotation
-
Menu bar using CSS sprites
That was it. Thank you very much for that. However I will certainly do a more general overall reset from now on. For cleanliness I omitted it when posting the code here, but the working links contained it. I'm sorry, what does that mean? Thank you very much.
-
Menu bar using CSS sprites
Hi, I'm having a small problem getting sprites to correctly line up side by side for an informal menu. I've created individual sprites of each item for a very simple rollover effect: Each sprite is 70px vertically (of which only 35px will be visible at any one time). I was going to put a 35px vertical separator graphic between each item: So basically I'm aiming for something similar to this (where I've simulated hovering the mouse over the Sympathy menu item): I'm a novice, however I was attempting to be clever using CSS, but failing as I used inline CSS (due to the menu items differing in pixel dimensions horizontally and I couldn't think of another way to do it other than the perhaps longer method of writing out four new CSS IDs - one for each menu item - with multiple tags for each ID etc.), but I placed each item into an inline unordered list: <ul class="menu-item"> <li><a href="#" style="width: 96px; background-image: url('weddings.png');"></a></li> <li><img src="tilde.png" /></li> <li><a href="#" style="width: 97px; background-image: url('sympathy.png');"></a></li> <li><img src="tilde.png" /></li> <li><a href="#" style="width: 68px; background-image: url('events.png');"></a></li> <li><img src="tilde.png" /></li> <li><a href="#" style="width: 97px; background-image: url('corporate.png');"></a></li> </ul> With more general CSS within the main Head tags. ul.menu-item li { list-style: none; display: inline; float: left; } ul.menu-item li a { display: block; height: 35px; text-decoration: none; background-position: 0px 0px; } ul.menu-item li a:hover { background-position: 0px 35px; } And this all works great!: http://infekted.org/...ng/ul-menu.html ...until I simply try to place the whole thing into an outer div (#menu) to consolidate and center it: http://infekted.org/...g/menu-div.html <div id="menu"> <ul class="menu-item"> <li><a href="#" style="width: 96px; background-image: url('weddings.png');"></a></li> <li><img src="tilde.png" /></li> <li><a href="#" style="width: 97px; background-image: url('sympathy.png');"></a></li> <li><img src="tilde.png" /></li> <li><a href="#" style="width: 68px; background-image: url('events.png');"></a></li> <li><img src="tilde.png" /></li> <li><a href="#" style="width: 97px; background-image: url('corporate.png');"></a></li> </ul> </div> ...with the added CSS:- #menu { width: 436px; height: 35px; margin: 0px auto; overflow: hidden; } I counted up all the horizontal pixels that all four menu items use, including three of the 'tilde' separator graphics inbetween them, and it all comes to 436px. However if I try to put the menu into a 436px wide div, it wont fit! In fact it wont fit until I enlarge the outer div to something crazy like 480px. Looking at the preview of the overall 'menu div' using Dreamweaver (I know Dreamweaver isn't particularly great, but can occasionally be useful to visualise problems that you can't necessarily see) and it shows the unordered list is being physically pushed down, to the side and out of the main div. I applied the overflow:hidden; tag to the #menu div to hide everything outside of it, but I'm not sure why the menu items are being pushed outside of it to start with. But would it be better just to not do the menu as a list, and instead just do each image separately (with separate IDs, each with multiple tags)? Any thoughts on what I'm doing wrong, or what might be better practice? Thank you
-
Looking for help turning this image into css..
Where to start... Divisions. The first step would be to divide the image into various associated areas (divs) - for example, for me, the header (logo) area at the top of the page would be one div, followed by another for the horizontal menu bar, another for the left hand menu bar, another for the splash content to the right of it, and so on, going down the page - then give each divs some fixed or relative dimensions, and nest them within each other. Once you have all the divs effectively laying out the page, then it's the creative CSS part - breaking each area into its constituent working parts, and using CSS to control the content within each div, how its displayed, and its functionality as required. Sorry it's a little woolly. Describing the best practices of CSS for the functionality for each and every one of those divs would take eons. PHP might be more appropriate for such an interactive, modular site.
-
tiff cropper ?
Try GIMP, it's a free open source graphics editor. http://www.gimp.org You can export to PNG, GIF or JPG. TIFF is not used for websites, generally. It's much too large a filesize and/or less compatible. As to what filetype to use, I wrote a guide in another thread:
-
how to add a contact me form
Hi, I've just tried the above, sending the form to a Yahoo email address, but for some reason it gets sent to the spam folder as opposed to the inbox. Any idea why this is? Thanks
-
-
Simple animated dropdown menu confusion
My bad, I forgot to add the noJS class to that CSS element to invoke it only when Javascript is unsupported. #menu li:hover ul.noJS { display: block; } Thanks Leon
-
Simple animated dropdown menu confusion
I've been following a tut on creating a simple animated dropdown menu with CSS and JQuery. I've emulated it to the best of my knowledge but I'm having problems with the JQuery animation. Instead of dropping the menu down when you hover over it, the menu folds up instead of down. Similarly when you don't hover the mouse over the menu, it drops down! The complete opposite of what is needed. Attempting to hover over a listed element within the dropdown menu keeps folding it up and down, up and down etc. in an infinite loop. Could anyone perhaps shed some light on it, please? With animated JQuery: http://www.infekted....enu-jquery.html Without animated JQuery: http://www.infekted....u-nojquery.html CSS: HTML: JQuery: For some reason the forum destroys my neatly nested text formatting when I insert it. Inserting as code instead of quotes is even worse. Thanks for any pointers.
-
-
Calling up an external text file...
Two reasons: 1, It's a starter webhost option and doesn't allow PHP (or Perl). http://www.lcn.com/web_hosting 2, I don't know PHP anyway! (Only HTML and CSS. )
-
Calling up an external text file...
Instead of inserting your actual text content within all the web code itself, is it possible to read a text file and then place the text contents of that file within <p></p> tags instead? Such as typing some text in notepad, saving it as something like "availabilities.txt", uploading it to the server and then have my webpage call upon that and insert it where needed, such as: <div id="page1"> <h1>Current availabilities</h1> <p>display contents of availabilities.txt here within this paragraph</p> </div> Reason I'm asking is to allow others (with FTP access) to easily edit the text on a page without them having to find exactly where it is within all the HTML coding (and potentially messing it all up). Is there an easy way to do this without using something like PHP? Thanks