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.


<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


$unreguser = $_REQUEST['unreguser'];

I have also tried using $_POST

What specifically’s the problem?

Seems like it should work, so there must be something else going on. Could you post more of your PHP?

scripts/proc_email_form.php

At the top of that script temporarily add these lines:


<?php
var_dump($_POST );
echo '<hr />';
?>

That is where is should appear.

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.

Yup, happens all the time. Thanks for taking the trouble to explain to others what the cause was, and what helped you find it.