mercredi 6 avril 2016

PHP elseif gives 'array' error when trying to echo the result [duplicate]

This question already has an answer here:

I have made a code that is supposed to increase value of items. Unfortunately i get this error.

Notice: Array to string conversion in /home/deb43619/domains/http://ift.tt/1N9hoZC on line 30 Array

The code:

<!DOCTYPE html>
<html>
    <head>
        <title>PHP:Opdracht 4</title>
        <link rel="stylesheet" type="text/css" href="#.css">
    </head>
    <body>
        <div class="header">
            <?php include "navbar.html"; ?>
        </div>
        <div class="content">
            <?php

            $var1 = $_POST;

            function Calculate() {

                if($var1 >= 100) {
                    $var1 * 1.15;
                    echo $var1;
                }
                elseif($var1 < 55) {
                    $var1 * 1.1;

                }
                else {
                    $var1 * 1.12;
                }
            }
            ?>
            <form method="post" action="3-php4.php">
                <br /> 
                Voer hier het bedrag van uw artikel in:
                    <input type="text" name="var1" placeholder="Bedrag...">
                    <input type="submit" name="submit" value="submit">
            </form>
        </div>
    </body>
</html>

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire