Welcome Guest, Not a member yet? Register   Sign In
Simple form, variables appear empty in script
#1

[eluser]mcair[/eluser]
Code:
<form method="post" action="auth/Login">
        <input name="btnLostPassword" type="button" value="Lost Password" class="btnlogin"/>
        <input name="btnRegister" type="button" value="Register" class="btnlogin"/>
        <label for="UserName">Username:</label>
        &lt;input name="UserName" type="text" maxlength="10" style="width: 70px;"/&gt;
        <label for="Password">Password:</label>            
        &lt;input name="Password" type="password" value="" maxlength="10" class="inputpassword" style="width: 70px;"/&gt;
        &lt;input name="RememberMe" type="checkbox" value="1" class="inputcheckbox"/&gt;
        <label for="RememberMe">Remember&nbsp;Me?</label>
        &lt;input name="btnLogin" type="submit" value="Go" class="btnlogin"/&gt;
        &lt;/form&gt;

I am logging the variables captured in this form, using the following code:

Code:
f_logarray('auth/login',$_POST);

Code:
function f_getarraystring($array)
{
    $temp = '';
    if (isset($array))
        foreach($array as $key => $value)
            $temp = $temp.$key.'=>'.$value.',';
    return $temp;        
}
function f_logmessage($source='Unknown',$message)
{
    log_message('debug',$source.'(IP:'.$_SERVER['REMOTE_ADDR'].'):'.$message);
}
function f_logarray($source='Unknown',$array)
{
     f_logmessage($source,f_getarraystring($array));
}

The form variables are logged with values sometimes, othertimes not. If I refresh the page and re-enter values in the form and submit it, the values do not always appear using the functions I have presentelisted. This stuff should be a piece of cake, yet I'm tearing my hair out trying to make sense of why the form variable values do not always get passed into the script. Using PHP Designer on Vista with WAMP, any tips on getting the XDebug to work would be much appreciated.
#2

[eluser]Flemming[/eluser]
Did you solve this yet? If not, why not simply print_r($_POST) in your controller after submitting the form - see what's been posted. It might be a good place to start your debugging?
#3

[eluser]mcair[/eluser]
[quote author="Flemming" date="1259008163"]Did you solve this yet? If not, why not simply print_r($_POST) in your controller after submitting the form - see what's been posted. It might be a good place to start your debugging?[/quote]

I did that, and it reinforced what I have seen using my methods: sometimes the form variables are populated as expected, other times they are not.

I think it's due to IE caching the page. I added META tags to prevent page caching and now the values are consistently populated. Not sure what page-cahcing has to do with submission of form variables and/or whether this is a shortcoming of IE.




Theme © iAndrew 2016 - Forum software by © MyBB