Jump to content


This topic is now archived and is closed to further replies.


Fixing My Form, please help.

Recommended Posts


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:

      // 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";
      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";


Share this post

Link to post
Share on other sites
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. 

Share this post

Link to post
Share on other sites


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.