Page 1 of 1

Problem with variables not posting

Posted: Fri Feb 02, 2007 6:57 pm
by Jhorra
I have taken out of the page the core code that is being used to test on a seperate page

Code: Select all

<form action='message_test.php' method='post'>
                <input type='hidden' name='mode' value='messages'>
                <input type='hidden' name='act' value='mes_list'>
                <input type='hidden' name='refer' value='inbox'>
                <input type='hidden' name='pro' value=''>

                <input type="checkbox" name="mes_id[]" value="17595" /></td><td>&nbsp</td><td><a href='index.php?mode=people_card&p_id=4'>pooh</a></td><td><a href='index.php?mode=messages&act=view_mes&mes_id=17595'>test</a>


           <input type='submit' value='Delete' onClick='this.form.pro.value="del"'>
           <input type='submit' value='Save' onClick='this.form.pro.value="sav"'>
           &nbsp&nbsp&nbsp&nbsp
           <input type='button' value='Compose Message' onClick='window.location="index.php?mode=messages&act=compose"'>&nbsp
           </form>
Every single value passes except for message id. I changed the name of the mes_id field to something I knew for a fact was not being used to see if it was being over written. If I post it back on this test page it passes the value, but when passed to index.php it never passes, no matter what it is named. Does anyone have any idea what could cause this?

Posted: Fri Feb 02, 2007 7:04 pm
by RobertGonzalez
Your passing it as an array. Are you retrieving it as such?

Posted: Fri Feb 02, 2007 7:57 pm
by Jhorra
Burrito helped me fix it, thanks to those who looked.

Posted: Sat Feb 03, 2007 9:43 am
by RobertGonzalez
For the other 20 something thousand members we have here, would you mind posting your fix?

Posted: Sat Feb 03, 2007 10:36 am
by m3mn0n
Yes that would help.

And for those that find this later on via searching: a good way to discover what's going on with your sent variables is by using a function such as print_r() to investigate in place of any actual processing.

eg.

Code: Select all

<?php
   echo '<pre>';
        print_r ($_REQUEST);
   echo '</pre>';
?>
Works well for all superglobals.

Posted: Sat Feb 03, 2007 5:59 pm
by RobertGonzalez
Someone posted a little function once before that went kinda like this:

Code: Select all

<?php
/**
 * Prints a cleanly formatted variable dump
 * @access public
 * @param mixed $var The variable to investigate
 * @return void Outputs the formatted variable information
 */
function clean_dump($var)
{
    echo '<pre>';
    var_dump($var);
    echo '</pre>';
}
?>
You could always include this function in a core include file and then use it as needed for debugging or getting information.