Jump to content


Photo

Fixing My Form, please help.


  • Please log in to reply
1 reply to this topic

#1 naitsirhc26

naitsirhc26
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 17 September 2006 - 05:20 AM

Hello,

I was wondering if anyone could help me to spice up my form. I want to be able to have required fields, sessions, and some way to be able to make it so the form that is sent to my email, is nicer looking. So the form that is sent is more formed. With bold fonts, etc...So it isn't hard to read. I would also like to make it so the person can check the information they typed, make sure it is correct, and then continue, or go back. Is there some way that I can display a link for the person to click to my homepage? If you could, I would love it if you could fix up the code, and paste it back here, and then I can learn from what you wrote. Thank you very much. As you can see, the code is simple and horrible right now:



<?php
  if ($_SERVER['REQUEST_METHOD']=="POST"){
      // In testing, if you get an Bad referer error
      // comment out or remove the next three lines
      if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||
        !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
        die("Bad referer");
      $msg="Values submitted by the user:\n";
      foreach($_POST as $key => $val){
        if (is_array($val)){
            $msg.="Item: $key\n";
            foreach($val as $v){
              $v = stripslashes($v);
              $msg.="  $v\n";
            }
        } else {
            $val = stripslashes($val);
            $msg.="$key: $val\n";
        }
      }
      $recipient="christian_hollingsworth@yahoo.com, christian@sleddoggin.com";
      $subject="Sled Doggin' Contact Form";
      error_reporting(0);
      if (mail($recipient, $subject, $msg)){
        echo "<center><h1>Thank you</h1><p>Message successfully sent! You will be redirected to the home page.</p></center><br>\n";
echo nl2br($input);
      } else
        echo "An error occurred and the message could not be sent.";
  } else
      echo "Bad request method";

?>

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 17 September 2006 - 07:40 AM

Hello and welcome to the board. 

Make a list of what you want. You mentioned a few things in your post. But actually make out a list of exactly what you want.  Drawing a picture also helps.  Then start at the beginning of the list and start coding.  If you run into trouble with figuring out how to make something work, ask for help on the bug.

We do not write code for people. We help them fix bugs.  If you wish for someone to (re)write your script, then I suggest you make a post in the freelance forum. Please read the forum guidelines before doing so. 

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users