SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Form parsing

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Form parsing

    I have managed to create this simple form, how do I parse info the user clicks on.

    HTML Code:
    <form id='sampleform' method='post' action='myurl.com' >
       <p>
       Name: <input type='text' name='Name' />
       </p>
       <p>
       Email: <input type='text' name='Email' />
       </p>
    <input type="radio" name="subject" value="maths" /> &pound;10
    <input type="radio" name="subject" value="physics" /> &pound;5
    <input type="radio" name="subject" value="physics" /> &pound;3
    &pound;<input type='text' name='donate-amount' />
       <p>
       <input type='submit' name='Submit' value='Submit' />
       </p>
    </form>

  2. #2

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2011
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi jelly46,

    I just want to suggest a small correction. In your form use a file name in the action. Right now you have used myurl.com instead of that use file name for example output.php, so that after the form is submitted it will go to output.php where you can process the form.
    PHP Programming Itís more than just writing code

  4. #4
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,098
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I usually process the posted variables in the same script, I would remove you're action from the form tag (leave it blank). then put this at the top of the page to visualize what you just posted.
    PHP Code:
    echo'<pre>'print_r($_POST); echo '</pre>'
    Now you will have variables to play with.
    Try
    PHP Code:
    echo $_POST['name']; 
    That's how you get your POST'ed variables.
    What I lack in acuracy I make up for in misteaks


Tags for this Thread

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
  •