Hi Guys
I was wondering if you could help me with a problem I am having.I`m trying to create a PHP file that enters information into 3 separate fields into a table row when the user enters information into a HTML form.
at the moment I have created this
<html>
<head>
<title>update database</title>
</head>
<body>
<form method="post" action="update.php">
Please state the category of problem that has occurred<br/>
<input type="text" name="category" size="70"/></br>
Please give a desription of the problem</br>
<input type="text" name="problem" size="70"/></br>
Please give a solution to the problem<br/>
<input type="text" name="solution" size="70"/></br>
<input type="submit" value="Submit the problem and solution"/>
</form>
</body>
</html>
<?php
$category = $_POST['category'];
mysql_connect ("localhost", "root","password") or die (mysql_error());
mysql_select_db ("heskdb");
$query="insert into hesk_std_replies (category) values ('$category')";
mysql_query($query) or die ('error updating database');
echo"database updated with:".$category;
$solution = $_POST['solution'];
mysql_connect ("localhost", "root","password") or die (mysql_error());
mysql_select_db ("heskdb");
$query="insert into hesk_std_replies (solution) values ('$solution')";
mysql_query($query) or die ('error updating database');
echo"database updated with:".$solution;
$problem = $_POST['problem'];
mysql_connect ("localhost", "root","password") or die (mysql_error());
mysql_select_db ("heskdb");
$query="insert into hesk_std_replies (problem) values ('$problem')";
mysql_query($query) or die ('error updating database');
echo"database updated with:".$problem;
?>
The problem with this is thatit enters the inormation into 3 incremental rows where I want it to be entered into the same row.
I have created this file which I thaught would work but it is giving me errors.
gdds
<?php
$category = $_POST['category'];
$problem = $_POST['problem'];
$solution = $_POST['solution'];
mysql_connect ("localhost", "root","password") or die (mysql_error());
mysql_select_db ("heskdb");
$query="insert into hesk_std_replies(category,problem,solution) values ('.$category.''.$problem.''.$solution.')";
mysql_query($query) or die ('error updating database');
echo"database updated with:".$category ,$problem,$solution;
?>