Hi, I'm in the basic learning phase in PHP and ran into a problem two days ago...
I need to make a function that $_POST to MySQL.
I think i have the function working but i cant make the form call the function to submit the data to my Database!
This is the function (filename is test.php) :
<?php function addlunch() {
$sql="INSERT INTO $tbl_name(vecka, dag, lunch1, lunch2)VALUES('$_POST[vecka]','$_POST[dag]','$_POST[lunch1]','$_POST[lunch2]')";
$result=mysql_query($sql);
mysql_close();
} ?>
And now the problem is to call the function to this form:
<form action="test.php?addlunch" method="post" name="lunch">
<input value="<?php echo ($veckonummer); ?>" name="vecka" type="text" /><br />
<input name="dag" type="text" value="MÃ¥ndag" /><br />
<textarea name="lunch1" cols="40"></textarea><br />
<textarea name="lunch2" cols="40"></textarea>
<input type="submit" value="Skicka" /><input type="reset" value="Rensa" />
</form>
If anyone could take a look at it i would appreciate it!!
Thx!