I want to insert two texts from a form in two seperate fields on a table in mysql in the same row.
I managed to insert them successfully but there is a problem.They have been submitted on database in different rows(IDs).How can i make them appeared in the same row?I have the following code:
[code=html]<form action=”insert.php” method=”POST”>
Title<br>
<input name=”titles” style=” width:596px;” type=”text” /><br><br>
Text<br>
<textarea style=”width:594px;” rows=”10″ cols=”20″ wrap=”physical” name=”text”>
</textarea><br><br>
<input type=”submit” style=”float:right;” value=”Submit Log” />
</form>
[code=php]<?php
// Connects to your Database
mysql_connect(“localhost”, “root”, “”) or die(mysql_error());
mysql_select_db(“project”) or die(mysql_error());
//This code runs if the form has been submitted
if (isset($_POST)) {
// now we insert it into the database
$insert = “INSERT INTO submit (titles)
VALUES (‘”.$_POST[‘titles’].”‘)”;
$add_link = mysql_query($insert);
$insert = “INSERT INTO submit (text)
VALUES (‘”.$_POST[‘text’].”‘)”;
$add_link = mysql_query($insert);
}
{ header(“Location:index.html”);
}
?>