简体   繁体   中英

form POST data array isn't posting into the php

This is some HTML code i have that echos from the A php file. I am Posting the data as an array, but when i read the array no data seems to pass to the B php file.

<form method="POST" id="Insert" action="Insert.php">
    <div>
        <div>
            Trans# : 
        <input 
        type="text" name="Out[]" value="'.$row['TransNum'].' "readonly
        >
        </div>

        <div>
            Date : 
        <input 
        type="text" name="Out[]" value="'.$row['Date'].'"
        >
        </div>

        <div>
            To / From : 
        <input 
        type="text" name="Out[]" value="'.$row['ToWhere'].'"
        >
        </div>

        <div>
            Amount : $
        <input 
        type="text" name="Out[]" value="'.$row['Amount'].'"
        >
        </div>

        <div>
        <input 
        type="submit" 
        value="UPDATE"
        name="SUBMIT"
        >
        </div>
    </div>  
</form>                 

And here is the php code.

if(isset($_POST['SUBMIT']))
{
    $PostData = $_POST['Out'];
    implode(", ", $PostData);
    $TransNum = $_PostData[0];
    $Date = $_PostData[1];
    $ToFrom = $_PostData[2];
    $Amount = $_PostData[3];
    $servername = "localhost";
    $username = "user";
    $password = "pass";
    $dbname = "Account";
    $lnfd = "<BR>";
    $HTMLOut = "";
    $HTMLOut .= "Data Should be Here ->".$TransNum.$Date.$ToFrom.$Amount;
    echo $HTMLOut.$lnfd;
    $TableName = "Transfer";
}

I have looked over the code several times and googled the hell out of it, but i cannot figure out why

$Date, $ToFrom, $Amount,  $servername

are all printing blank in the php.

Doing this

implode(", ", $PostData);

implodes into nothing, while this

$string = implode(", ", $PostData);

will put the result of the implode somewhere you can make us of it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM