Question

I have searched similar questions but none of the solutions have worked for me.

I have a simple form as shown below.

<form method="post" action="login.php" name="login-form" id="login-form">
                        <table style="margin: 0 auto; width: 250px;">
                            <tr>
                                <td style="padding-top: 20px;">
                                    <div class="input-group margin-bottom-sm"> 
                                        <span class="input-group-addon"> 
                                            <i class="fa fa-user fa-fw"></i>
                                         </span>
                                        <input name="username" class="form-control custom-input" type="text" placeholder="Username" id="focusedInput">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding-top: 15px;">
                                    <div class="input-group"> 
                                        <span class="input-group-addon">
                                            <i class="fa fa-key fa-fw"></i>
                                         </span>
                                        <input name="password" class="form-control" type="password" placeholder="Password">
                                        <input id='loginSubmit' name='loginSubmit' type="hidden" value="<?php print md5(time()); ?>">
                                  </div>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding-top: 15px;">
                                    <button name="login" id="login" type="submit" class="btn-inverse button-custom" data-section="2">
                                        Sign In
                                        <i class="fa fa-sign-in fa-fw"></i>
                                    </button>
                                </td>
                            </tr>
                        </table>
                    </form>

This form is submitted to login.php file as shown below.

 <?php 

 print_r($_REQUEST);
 print_r($_GET);
 print_r($_POST);

?>

My problem is that when I submit the form I am not able to get the form variables on the login.php file. All three arrays contain nothing.

Am I doing anything wrong here?

My code works fine outside tideSDK. The launcher doesn't show any errors. Can any one please help me with this? or explain where I can see detailed error messages?

Thanks in advance.

Était-ce utile?

La solution

I've found the problem hope this helps someone else.

Apparently tideSDK treats GET and POST in the same manner. So you don't have to specify the form method attribute on the forms and the form variables can be accessed using $_GET as shown in the code below.

<form action="login.php">
    <input type="text" name="username" />
    <input type="submit" name="submit" value="Submit" />
</form>

These can be retrived in login.php as:

<?php
      print $_GET['username'];
?>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top