Jump to content

Fixing My Form, please help.


naitsirhc26

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.