Jump to content

Lucy

Members
  • Posts

    126
  • Joined

  • Last visited

Everything posted by Lucy

  1. Is there a way to tell whether the form handler file is actually being used? Edit - Okay, tested it using an invalid email address. It isn't being used at all. Edit 2 - ... The wordpress code for the url wasn't working the way I thought it should. That was the problem. It's still not working, but I'm actually getting error messages now. I'll keep you posted ( post? Get it? Haha - I'm far too tired for this)... Edit 3 - It works! Many thanks for all the help.
  2. I've changed it to have both name and value set to 'message' - however, still doesn't work. Niche - This was really the simplest I could find. I don't think there's a problem with the form handler itself, because I'm using it on another (non-Wordpress) site and it works fine there.
  3. It returns ' array(0) { } ' ... that's probably not good, then?
  4. I'm using the same contact form code (not written by me, as I don't understand PHP very much) that I have on my Portfolio website. It definitely works there. However, it won't on a Wordpress site I'm working on. You fill in the fields, submit, and it simply comes up with the message about no posts being found - I take that to mean it can't find the page, except it's not meant to GO to the PHP file, it's meant to use it... I noticed the search bar originally had a messed up address for the PHP file on submitting originally, so I've altered it so it should use the correct link, and the address bar now shows 'contact.php', the original page the form is submitted on. But with the same error - and no message is sent at any point. I'll post the code below. I don't really understand what's going on at all, would appreciate any help. Contact form: <form action="<?php get_template_directory_uri() . '/contact-form-handler.php' ; ?>" method="POST" name="contactform"> <label for="name">Name*:</label> <input type="text" name="name" required> <label for="email">Email*:</label> <input type="email" name="email" required> <label for="message">Message*:</label> <textarea required></textarea> <input type="submit" value="Send"> </form> contact-form-handler.php: <?php $errors = '';$myemail = 'admin@*************k'; if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])){ $errors .= "n Error: all fields are required";}$name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; if (!preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i", $email_address)){ $errors .= "n Error: Invalid email address";}if( empty($errors)){ $to = $myemail; $email_subject = "Contact form submission: $name"; $email_body = "You have received a new message. ". " Here are the details:n Name: $name n Email: $email_address n Message: $message"; $headers = "From: $myemailn"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header('Location: *************/thanks/');} ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>Contact form handler</title></head><body><!-- This page is displayed only if there is some error --><?phpecho nl2br($errors);?></body></html> If you need any more information please say.
  5. Ah... that's interesting - thank you! Changing the position into pixels/rem works much better.
  6. I have a large (originally vector) image which, when placed in image tags with a width of 100%, scales down just fine - it retains all its crispness. However, if set as a background image in the same area, despite being scaled to the same size, becomes somewhat blurry. Also, I've noticed when making the browser smaller, it becomes sharper during movement and then 'sets' back to the blurry image. Does that make sense? Here's my CSS: #left { float:left; width:25%; margin-left:2%; padding-top:2%; background-image:url('images/logo.png'); background-repeat:no-repeat; background-position:50% 5%; background-size:contain;} Can anyone help? I looked into it and the consensus seems to be that browsers aren't very good at resizing - that's fine, but then why does the image look great as an element on the page? I must be missing something here.
  7. I might be misinterpereting this, but I don't think koolx is working on a website - I think they're using a bit of CSS to override the styles for all the websites they visit.
  8. Also, do you know why it is that the hover colour is not applied if the background for #catwrapper #select_bg is written in shorthand?
  9. Sorry, I made a mistake when adding in the image name - it does work. Thanks!
  10. Thanks for the reply. Unfortunately, that doesn't seem to work :/ Weird thing is, the z-index thing isn't working as it should. Despite giving #category select a lower z-index number than #catwrapper, it regardless stays on top (I discovered this when changing the background for #category select to a colour from inherit, which makes it cover up the arrow). Can't understand why this is happening...
  11. I have a dropdown menu which I have styled in such a way that the default arrow is hidden and I have put in my own as a background image. I have a background colour on hover and when the box is selected. The problem is, this background is replacing the arrow image instead of going underneath as I hoped it would. Is there a solution to this? I've tried a few things but nothing has worked. Code is below, attaching images to show you what I mean. CSS: input , select { border:.1rem #1F3049 solid; background:inherit; padding:.3rem; -webkit-transition:1s; -moz-transition:1s; transition:1s; }input:hover, select:hover, input:focus, select:focus { background:#D19292; -webkit-transition:1s; -moz-transition:1s; transition:1s; }#catwrapper { margin:0 0 0 25%; width:44%; border:.1rem #1F3049 solid; background:url('images/darrow.png') no-repeat 95% 70%; }#category { overflow:hidden; width:100%; }#category select { color:#05285B; font-family:inherit; font-size:1.5rem; border:none; width:115%; } HTML: <div id="catwrapper"> <form id="category"> <select name="category" required> <option selected="selected" disabled="disabled">choose a category</option> <option value="breakfast">breakfast</option> <option value="lunches">lunch</option> <option value="dinners">dinners</option> <option value="dessert">dessert</option> </select> </form></div>
  12. I know, but I only want it to be hidden under some circumstances (when the post is not shown in full) - that's where I thought PHP might come in?
  13. Could someone point me in the right direction with this? Not expecting anyone to write the code up for me, and I suspect it's not possible, but anyhow... I'm making a Wordpress theme and want to enable my client to add an image to their posts that will act as a border. It will float to the left alongside the post. The issue is that the image needs to be inserted at the very top of the post to make this work; therefore, it sits before the ' <--more--> ' tag and currently shows up in post snippets. The images are going to be made to fit the full size post, so obviously this isn't going to look good. I have created a class for said images so I thought I might be able to use PHP to make it so images with that class will not show up in the short version of the post. Or is this more of a Javascript thing?
  14. Thanks - that does help, although it creates a huge gap... picture below: Can't find anything that might cause this. There aren't any large margins there or anything. Edit - I've given the divs red backgrounds so you can see exactly what's going on
  15. Hope this is okay to post in here - it actually involves HTML, CSS and PHP, but this seemed the best place. I'm making a Wordpress theme for someone. It took me maybe an hour to make the static site - converting it to a Wordpress site has been a nightmare... so, here's my latest problem. I tried to put a small box below the posts on the homepage for users to subscribe to email alerts. It refused to display where it should. I've re-created this using the simple page template which has less code to sort through with some text. Here's a picture of what's happening: The text 'test' should be on the left hand side, below 'just a test'. As far as I can see there's literally no reason it shouldn't. All relevant code below: The above page: <?php get_header (); ?> <div id="content"> <ul id="nav"> <?php wp_nav_menu( array( 'container_class' => 'main-nav', 'theme_location' => 'primary' ) ); ?> </ul> <?php get_sidebar(); ?> <div class="standard"> <?php if (have_posts()) : while (have_posts()) : the_post();?> <h2><?php the_title(); ?></h2> <p><?php the_content(__('(more...)')); ?></p> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; wp_reset_query(); ?> </div> test! <div class="formobile"><a href="#nav"><i>To menu</i></a></div> </div> <?php get_footer(); ?> CSS: #content { width:1350px; margin:auto; padding-bottom:20%; background-color:#F9F5E4; color:#7C6C75; font-size:2rem; overflow:auto; }#nav { list-style-type:none; margin:1% 0 0 8%; text-transform:uppercase; } #nav li { background-color:#EDE4BC; border:solid .2rem #F4DF84; width:10%; margin:0 .5%; display:block; float:left; text-align:center; font-size:1.5rem; letter-spacing:.1rem; } #nav a:hover { color:#D673B0; background-color:#F7F1D6; } #nav a { display:block; color:#AF6191; padding:5% 0%; }.standard { width:68%; float:left; margin:1% 0 0 1%; padding:5%; }.formobile { width:0; height:0; display:none; } Sidebar.php: <div id="side"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus, sapien non venenatis interdum, lectus risus vulputate nibh, et placerat tortor arcu facilisis risus. Etiam mauris magna, blandit quis ornare ac, malesuada dignissim nulla. Sed dignissim lorem mi, eu elementum dui accumsan a. </p> <img src="<?php bloginfo('template_directory'); ?>/images/advert.jpg" alt="advertisement"/> <img src="<?php bloginfo('template_directory'); ?>/images/advert.jpg" alt="advertisement"/> <br/> <a href=""><i>Facebook</i><br/></a> <a href=""><i>Twitter</i><br/></a> <a href=""><i>Pinterest</i><br/></a> </div> CSS for sidebar: #side { width:17%; padding:1.5%; float:right; background-color:#F4E9BA; font-size:1.75rem; line-height:130%; } #side img { width:80%; display:block; margin:auto; padding:5% 0; } Header.php: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Title <?php wp_title(); ?></title> <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> <?php wp_head(); ?> </head> <body> <header><img src="<?php bloginfo('template_directory'); ?>/images/picture.jpg" alt="pretty picture"/></header> Footer.php: <div id="footer"></div> <?php wp_footer(); ?> </body> </html> CSS for footer: #footer { width:1350px; height:100px; margin:auto; background-color:red; } Please help, this is driving me mad
  16. Lucy

    Wordpress menu

    Edit - never mind, all solved.
  17. I have been asked to create a blog site for someone using Wordpress. I've got the static website designed/coded, but am unsure of how to make it into a theme for them. I did find one tutorial (literally could only seem to find one...) but it seemed to require a knowledge of PHP - which I'm currently lacking. I don't want to make this person wait until I've learned PHP. Can anyone point me in the right direction? To be honest, I'm completely lost when it comes to Wordpress. I'm still not entirely sure whether it's a 'theme' I need to create or something else. Sorry if this isn't the right place to post this.
  18. Great, thanks. There seemed to be a delay in the files loading properly but all seems sorted now. I've added in all the textual content and a portfolio piece now, so I hope it looks better? Considering using it in a job application...
  19. Thanks, Niche. I'll bear those questions in mind. Just to check, is it displaying the custom font for you? (It's quite angular, will probably be obvious if you can see it)
  20. Ah, of course... I honestly spent hours staring at all this trying to spot something like that Thanks so much, it works perfectly now
  21. <form name="contactform" method="POST" action="contact-form-handler.php" id="contact"> <div id="left"> <label for="name" class="lab">name:</label> <input type="text" name="name" class="fh" required> <label for "company" class="lab">company:</label> <input type="text" name="company" class="fh"> <label for "email" class="lab">email:</label> <input type="email" name="email" class="fh" required> </div> <div id="right"> <label for="message" class="lab">message:</label> <textarea name="message" rows="10" class="mes" required></textarea><br/> <input type="submit" value="send" id="send"> </div> </form> There you go I could always just do away with the company field, I suppose, if it won't work.
  22. I'm using the following PHP to send information from a contact form on my website to my email address: <?php $errors = '';$myemail = ''; if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])){ $errors .= "n Error: all fields are required";}$name = $_POST['name']; $company = $_POST['company'];$email_address = $_POST['email']; $message = $_POST['message']; if (!preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i", $email_address)){ $errors .= "n Error: Invalid email address";}if( empty($errors)){ $to = $myemail; $email_subject = "Contact form submission: $name"; $email_body = "You have received a new message. ". " Here are the details:n Name: $name n Company: $company n Email: $email_address n Message: $message"; $headers = "From: $myemailn"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page} header('Location: thankyou.html'); ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>Contact form handler</title></head><body><!-- This page is displayed only if there is some error --><?phpecho nl2br($errors);?></body></html> It's from a website, free for use, can't remember where though. I have an additional field to the default ones in my form - 'company'. As you can see, I've tried to add in extra bits for it, but I still get an empty contact field in the email every time I test it. I should point out, I really don't know what I'm doing with PHP. Not sure where I'm going wrong with this, any ideas?
×
×
  • Create New...