Error or not and insert to database mysql
        Posted  
        
            by Azzyh
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Azzyh
        
        
        
        Published on 2010-05-17T12:14:41Z
        Indexed on 
            2010/05/17
            12:31 UTC
        
        
        Read the original article
        Hit count: 269
        
php
Why wont this work?
<?php include "top.php"; 
include "connect.php";
if(isset($_POST["submit"])) {
$error = "";
    if(empty($_POST["name"])) {
        $error .= "Du glömde märket!<br>";
        if(empty($_POST["rating"])){
        $error .= "Du glömde att bedömma märket!<br>";
                if(empty($_POST["worth"])){
        $error .= "Du glömde att välja vilken klass den hör till!<br>";
                if(empty($_POST["username"])){
        $error .= "Du glömde att skriva ditt namn!<br>";
                if(empty($_POST["rating"])){
        $error .= "Du glömde att skriva någonting?!!<br>";
        }}}}}
    if(!empty($error)){
    echo $error;
    }else{
$name = $_POST["name"];
$rating = $_POST["rating"];
$worth = $_POST["worth"];
$favorite = $_POST["favorite"];
$username = $_POST["username"];
$description = $_POST["description"];
mysql_query("INSERT INTO brands (name, rating, worth, favorite, username, description) VALUES ('$name', '$rating', '$worth', '$favorite', '$username', '$description')");
echo "<span style='color: green'>Yir yir, <a href='brand.php'>klicka här för att gå till Märken.</a></span>";
    }
    }
It doesnt come with errors it just say the succeed message like it has inserted to database
© Stack Overflow or respective owner