0

im trying to insert values on form submit but no result nothing is entering in the databse not even empty values,

if(isset($_POST['signup'])) {  

    mysql_query("INSERT INTO user (fname, lname)
    VALUES ('Peter', 'Griffin')");
}

i checked if theres connection to database and it's connected. ANYONE ?

8

1 Answer 1

2

Execute the query directly in query browser or any of mysql editors and check whether it is inserted. If it is inserted successfully, just check like this.

if(isset($_POST['signup'])) {  
    echo "Inside";
    exit;
    mysql_query("INSERT INTO user (fname, lname)
    VALUES ('Peter', 'Griffin')");
}

If it doesn't display Inside, then the problem is in if(isset($_POST['signup'])). Check it.

Sign up to request clarification or add additional context in comments.

2 Comments

how query will execute when you exist before query ?
In this case, the query won't execute. But he has to know whether the control comes inside the if condition. If it wont come, the condition fails. So he can come an conclusion that the problem is in $_POST['signup'].

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.