1

I have made a page that uses 3 forms. 2 of the forms i can catch the post information using the $_POST var. One of my forms however returns an empty $_POST var. I can catch it using the old $_HTTP_POST_VARS

I have matched my form with the other forms and can find no differences. My php version is 5.2.17 neither var_dump($_POST) or print_r($_POST) give me any result.

I eventualy got it working using the $_HTTP_POST_VARS but it keeps on buggling me, since $_POST was made to replace $_HTTP_POST_VARS since php 4.1 (or something close to that)

                    <p>Wachtwoord wijzigen</p>
                <form id='changepwsd' name='changepswd' method='POST' action='".basename($_SERVER['PHP_SELF'])."' enctype='application/x-www-form-urlencoded'>
                    <label for='old' style='width: 170px; display: inline-block;'>Vorig wachtwoord:</label>
                    <input type='password' name='old' /><br />
                    <label for='new' style='width: 170px; display: inline-block;'>Nieuw wachtwoord:</label>
                    <input type='password' name='new' /><br />
                    <label for='confirm' style='width: 170px; display: inline-block;'>Bevestig wachtwoord:</label>
                    <input type='password' name='confirm' /><br />
                    <input type='submit' value='Wijzig' name='changepwsd' style='width:120px'/>
                </form>
                <br><br>

the correspondig php:

session_start();
include 'mysql.php';

$mysql = new MySQL;
$now = date("Y-m-d H:i:s"); 
$mysql->db_connect();
if(!empty($_POST['changepwsd']))
{
    $mysql->select_qry('*','users','Name',$_SESSION['User']['Name']);
    while($row = $mysql->qry_result->fetch_assoc())
    {
        $user = $row;
    }
    if(md5($_POST['old']) == $user['Password'])
    {
        if($_POST['new'] == $_POST['confirm'])
        {
            $resultaat = "Uw wachtwoord werd gewijzigd";
            $mysql->qry("UPDATE users SET Password='".md5($_POST['new'])."' WHERE Name='".$_SESSION['User']['Name']."'");
        }
        else
        {
            $resultaat = "Wachtwoorden komen niet overeen.<br>Uw wachtwoord werd <b>niet</b>gewijzigd.";
        }
    }
    else
    {
        $resultaat = "Uw oud wachtwoord klopt niet.<br>Uw wachtwoord werd <b>niet</b>gewijzigd.";
    }
    return $resultaat;
}
Pascal
  • 11
  • 2
  • 1
    Can you show your PHP code please – paddyfields Mar 22 '15 at 15:52
  • There will be a typpo in your PHP code. – Eda190 Mar 22 '15 at 15:52
  • While you attempt to fix `$_POST` consider stopping using `HTTP_POST_VARS` at all as `register_long_arrays` is removed as of PHP 5.4.0. – DeDee Mar 22 '15 at 15:55
  • Strange, seems to me that there is configuration issue or you're clearing `$_POST` on a different location. This could be the solution to your problem: http://stackoverflow.com/questions/9914979/php-post-not-working – Paul Mar 22 '15 at 19:05
  • @paul, i have looked at the solution from that post, but it din't give me any solution – Pascal Mar 23 '15 at 17:28

0 Answers0