SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    having problems using hidden fields in forms

    I'm trying to pass a value stored in a hidden field in a form over to my php script, but can't seem to get it to work.

    HTML Code:
    <form action='scripts/proc_email_form.php' method='post' name='form' id='form' accept-charset='utf-8'>
       <fieldset>
           <input type='hidden' name='unreguser' value='4' id='unreguser' />
           <textarea name='message' rows='8'></textarea>
         </fieldset>
    
         <input type='submit' value='Send' />
    </form>
    php script
    HTML Code:
    $unreguser = $_REQUEST['unreguser'];
    I have also tried using $_POST

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2010
    Posts
    455
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What specifically's the problem?

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by aaron4osu View Post
    I have also tried using $_POST
    Seems like it should work, so there must be something else going on. Could you post more of your PHP?

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    scripts/proc_email_form.php

    At the top of that script temporarily add these lines:
    PHP Code:
    <?php
    var_dump
    ($_POST );
    echo 
    '<hr />';
    ?>
    That is where is should appear.
    Last edited by Cups; Oct 2, 2012 at 03:30. Reason: simplified a bit more

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks that helped me find the error. It was grabbing the variable but when I tested it by echo the variable i left off the $ in front of the variable.

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Yup, happens all the time. Thanks for taking the trouble to explain to others what the cause was, and what helped you find 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
  •