Tuesday, 10 September 2013

No error with mysql

No error with mysql

I have been messing around with php and sql quite many hours now. But It
gives me no errors and it wont upload data from the form to the database.
I Dont know if its against the rules, but I would be very pleased if
someone could debug my code. Im trying to get the data from form "meist"
and but it into the database when submit is pressed.
PHP`
<?php
// Make a MySQL Connection
mysql_connect("XXX", "XXX", "XXX") or die(mysql_error());
mysql_select_db("content") or die(mysql_error());
$meist = mysql_real_escape_string($_POST['meist']);
$meist = $_POST['meist'];
mysql_query("INSERT INTO content_data (meist) VALUES ($meist)"
or die(mysql_error));
echo "Data Inserted!";
?>
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Form Input Data</title>
</head>
<body>
<td>
<table>
<form method="post" action="input.php">
<tr>
<td>Name</td>
<td><input type="text" id="meist" name="meist" size="20">
</td>
</tr>
<tr>
<td></td>
<td align="right"><input type="submit"
name="submit" value="Sent"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Thanks in advance. `

No comments:

Post a Comment