Hallo,
Ich möchte per POST einen text an ein php script übergeben, welches den Text in eine tabelle einfügt.
Zuvor soll die tabelle gellert werden.
html:
php:
Es kommt nichts zurück
Bin Anfänger und weiß nicht weiter -.-
Ich möchte per POST einen text an ein php script übergeben, welches den Text in eine tabelle einfügt.
Zuvor soll die tabelle gellert werden.
html:
Code:
<html>
<body>
<form action = "test.php" method = "post">
<p align="center"><input name = "data" maxlength="20">
Daten<p>
<p align="center"><input type = "submit">
<input type = "reset">
</form>
</body>
</html>
PHP-Code:
<?php
$data = $_POST["data"];
if (strlen($data) > 4)
{
$link = mysql_connect("***","***", "***");
mysql_select_db("***");
$sql = "TRUNCATE TABLE `***`; INSERT INTO `***`.`***` (`spalte1`, `spalte2`) VALUES (\'" . mysql_real_escape_string($data) . "\', \'" . time() . "\');";
$res = mysql_query($sql, $link);
echo $res;
}
else {echo 0;}
?>
Bin Anfänger und weiß nicht weiter -.-

Kommentar