I am trying to post some data to the php but i could not send anything and see where the problem is.The codes looks fine to me.In other words, i could not reach inside of if statement.Codes;
<form method="post" action="home.php" name="home" id="home">
<label for="in_come">enter something: </label><input type="text" name="in_come" id="in_come" /><br/>
<?php
echo "outside if";
if(isset($_POST['in_come']))
{
echo "inside if";
$income = $_POST['in_come'];
$registerquery = mysql_query("INSERT INTO income (income) VALUES ('".$in_come."')");
if ($registerquery)
{
echo "sended";
}
}
?>
if echo "inside if";
is not working, try
if (isset($_POST['in_come']) && ($_POST['in_come'] != ""))
instead of
if(isset($_POST['in_come']))
You assign $income
but later you use $in_come
in your query
$income = $_POST['in_come'];
$registerquery = mysql_query("INSERT INTO dersler (income) VALUES ('".$in_come."')");
//-----------------------------------------------------------------^^^^^^^^^^^^^^^
Incidentally, this won't hurt your PHP, but the you also have used <label for='income'>
while the input's id
is actually id='in_come'
.
To debug the contents of your POST and verify that $_POST['in_come']
is set, use:
var_dump($_POST);