Jump to content

Deviatore

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Deviatore's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello everyone, i have a site here :- http://www.techahcker.org If you navigate to the contact Us page - http://www.techhacker.org/?page_id=262 It was an inbuilt contact form in which the reason field wasn't there. i tried to add a custom field of mine, the Reason field. I also wrote codes for it to make it necessary to enter the reason. but when the user doesnt fill it, it does not display any error like it displays in the name field, email field and message field by adding a red border to the input box. here is the send.php :- <?php if(isset($_POST['Send'])){ $errorC = false; $the_name = $_POST['yourname']; $the_email = $_POST['email']; $the_website = $_POST['website']; $the_reason = $_POST['reason']; $the_message = $_POST['message']; #want to add aditional fields? first add them to the form in template_contact.php, then create variables like the ones above # # $your_field = $_POST['name_of_your_field']; # # last thing to do is to edit the message, see bottom of this file if(!checkmymail($the_email)) { $errorC = true; $the_emailclass = "error"; }else{ $the_emailclass = "valid"; } if($the_name == "") { $errorC = true; $the_nameclass = "error"; }else{ $the_nameclass = "valid"; } if($the_reason == "") { $errorC = true; $the_reasonclass = "error"; }else{ $the_reasonclass = "valid"; } if($the_message == "") { $errorC = true; $the_messageclass = "error"; }else{ $the_messageclass = "valid"; } if($errorC == false) { $to = $_POST['myemail']; $subject = $_POST['reason']; $header = 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $header .= "From:" .$_POST['yourname'] . "<[email protected]>\r\n"; $message1 = nl2br($_POST['message']); $message = "New message from $the_name <br/> Mail: $the_email<br /> Website: $the_website <br /> Reason: $the_reason <br /><br /> Message: $message1 <br />"; /* $message = "New message from $the_name <br/> YOUR FIELD: $your_field <br/> Mail: $the_email<br /> Website: $the_website <br /><br /> Message: $message1 <br />"; */ mail($to, $subject, $message, $header); if(isset($_POST['ajax'])){ echo"<h3>Your message has been sent!</h3><p> Thank you!</p>"; } } } function checkmymail($mailadresse){ $email_flag=preg_match("!^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$!",$mailadresse); return $email_flag; } ?> and here is the template_contact.php which includes the fields :- <?php /* Template Name: Contact Form */ global $k_options; $name_of_your_site = get_option('blogname'); $email_adress_reciever = $k_options['contact']['contact_mail'] != "" ? $k_options['contact']['contact_mail'] : get_option('admin_email'); if(isset($_POST['Send'])) { include('send.php'); } get_header(); ?> <div id="content" class="bg_sidebar"> <div id="inner_content"> <?php if (have_posts()) : while (have_posts()) : the_post(); $punchline = get_post_meta($post->ID, "punchline", true); $portfolio_image = get_post_meta($post->ID, "portfolio-image", true); ?> <div class="entry"> <span class="meta"><?php echo $punchline; ?></span> <h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry-content"> <?php if($portfolio_image != "") echo '<img class="aligncenter" src="'.$portfolio_image.'" alt="" />'; ?> <?php the_content(); ?> </div><!--end entry-content--> <form action="" method="post" class="ajax_form"> <fieldset><?php if (!isset($errorC) || $errorC == true){ ?><legend><span>Send us a mail</span></legend> <p class="<?php echo $the_nameclass; ?>" ><input name="yourname" class="text_input empty" type="text" id="name" size="20" value='<?php echo $the_name?>'/><label for="name">Your Name*</label> </p> <p class="<?php echo $the_emailclass; ?>" ><input name="email" class="text_input email" type="text" id="email" size="20" value='<?php echo $the_email?>' /><label for="email">E-Mail*</label></p> <p class="<?php echo $the_reasonclass; ?>" ><input name="reason" class="text_input empty" type="text" id="reason" size="20" value='<?php echo $the_reason?>' /><label for="reason">Reason*</label></p> <p><input name="website" class="text_input" type="text" id="website" size="20" value="<?php echo $the_website?>"/><label for="website">Website</label></p> <label for="message" class="blocklabel">Your Message*</label> <p class="<?php echo $the_messageclass; ?>"><textarea name="message" class="text_area empty" cols="40" rows="7" id="message" ><?php echo $the_message ?></textarea></p> <p> <input type="hidden" id="myemail" name="myemail" value="<?php echo $email_adress_reciever; ?>" /> <input type="hidden" id="myblogname" name="myblogname" value="<?php echo $name_of_your_site; ?>" /> <input name="Send" type="submit" value="Send" class="button" id="send" size="16"/></p> <?php } else { ?> <p><h3>Your message has been sent!</h3> Thank you!</p> <?php } ?> </fieldset> </form> </div><!--end entry--> </div><!-- end inner_content--> <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <!--do not delete--> <?php endif; ?> <?php get_sidebar(); ?> </div><!-- end content--> <?php get_footer(); ?> Can anybody help me please ?
  2. The whole thing is very simple. Just the need is that i want to provide the user features like bolding the text, adding images, just like when u post something here, u have smilies, font change etc. and at last when it has to be published, it gets published in some format.
  3. Hey, I am new to PHP and only now in the beginning.I am making a website related to photoshop, animation and other kinds of tutorials website.The thing is that i want an application in my website by which any person can submit a tutorial. You can visit my website here once but i have just started to make it: www.pixelspedia.com (Please refresh it once if u cant see it) I want something like this: http://www.pixel2life.com/publish/write/ Please if someone can help me then I am ready to return him the same as much as I can.
×
×
  • 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.