SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Location
    India
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Help I am beginner! What is wrong with this form?

    I wrote up all three files and put them in a sub-directory of htdocs directory of XAMPP software.
    Then I loaded up "index.php" from the browser. The form filed comes. When I enter the details in the form and clicked submit, the same page reloaded and the form becomes blank.
    I wanted to know what is wrong with these?

    Here are the files:
    Code:
    http://www.ziddu.com/download/23058035/controller.zip.html
    Last edited by aakashekhar; Sep 28, 2013 at 15:32. Reason: Forgot to place the file

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Show us your code. no links.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Location
    Scotland
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You really need to display the code here, I won't and I am sure others won't download a zip file to then try to assist you.

    So please help us to help you by displaying the code properly.
    Free2host.co.uk - My longest ever project at 10 years

  4. #4
    SitePoint Member
    Join Date
    Apr 2013
    Location
    India
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for inconvenience guys.
    Here's the code:

    index.php:

    Code:
    <?phpif (!isset($_REQUEST['fistname']))
    {
    include 'form.php';
    }
    else
    {
    $fistname = $_REQUEST['firstname'];
    $middlename = $_REQUEST['middlename'];
    $lastname = $_REQUEST['lastname'];
    
    
    if ($firstname == 'Akash' and $middlename == 'the' and $lastname == 'Developer')
    {
    $output = 'Welcome my friend!';
    }
    else
    {
    $output = 'Welcome ' . htmlspecialchars($firstname, ENT_QUOTES, 'UTF-8') . ' ' . htmlspecialchars($middlename, ENT_QUOTES, 'UTF-8') . ' ' . htmlspecialchars($lastname, ENT_QUOTES, 'UTF-8');
    }
    include 'include.php';
    }
    include.php:

    Code:
    <html><head>
    <title>Form Include</title>
    </head>
    <body>
    <p><?php echo $output; ?></p>
    </body>
    </html>
    form.php:

    Code:
    <html><head>
    <title>Form</title>
    </head>
    <body>
    <form action=' ' method='post'>
    <div><label for='fistname'>First Name: <input type='text' name='firstname' id='firstname'></label></div>
    <div><label for='middlename'>Middle Name: <input type='text' name='middlename' id='middlename'></label></div>
    <div><label for='lastname'>Last Name: <input type='text' name='lastname' id='lastname'></label></div>
    <div><input type='submit' value='GO'></div>
    </body>
    </html>

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,117
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Try adding a space at the start of your PHP. I.e.

    This

    Code:
    <?php if
    instead of this:

    Code:
    <?phpif
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Try correcting all your uses of $fistname to $firstname.

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,117
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by ginerjm View Post
    Try correcting all your uses of $fistname to $firstname.
    Well spotted.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  8. #8
    SitePoint Member
    Join Date
    Apr 2013
    Location
    India
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks @ginerjm
    got it!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •