Values appear not to carry over when posted
Posted: Thu Oct 12, 2006 2:46 am
feyd | Please use
Action Enter Fruits[/syntax]
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am a newbee and with little programming experience. I've just installed php and mysql and they seem to work fine. When submitting a form however, whilst mysql monitor shows that a new row is added, no values appear in the field columns. Is there a problem with the installation or am I making a simple mistake with the code below? I'm using Dreamweaver to write the code. Thanking you in advance.
[b]Enter Fruits[/b]
[syntax="html"]<html>
<head>
<title>Enter Fruits</title>
</head>
<h1>Enter Fruits</h1>
<body>
<form id="form1" name="form1" method="post" action="ActionEnterFruits.php">
<label>name
<input type="text" name="name" />
</label>
<label>colour
<input type="text" name="colour" />
</label>
<p>
<label>Submit
<input type="submit" name="Submit" value="Submit" />Code: Select all
<html>
<head>
<title>Add Data</title>
</head>
<body>
<?php require_once('Connections/Fruits.php');
echo "the colour is...".$colour;
$adddata = "INSERT INTO fruits(name, colour)
VALUES('$name','$colour')";
$result = mysql_query($adddata);
?>
<h2> Thank you, we have added the data to the database</h2><BR />
<a href="enter fruits.html">click here to return to enter page
</body>
</html>
</label>
</p>
</form>
</body>
</html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]