i have two tables, polls and poll_options.
I need to insert into polls 'poll_id(auto encrament)', 'title', 'user_id')
then i need to insert into poll_options ('poll_id(which i have to recieve from the polls table)', 'postan1', 'postan2', 'postan3')
Here is my form
<form action="newPoll.php" method="POST"> Tilte:<input type="text" name="title"/><br /> Answer 1:<input type="text" name="postan1"/><br /> Answer 2:<input type="text" name="postan2"/><br /> Answer 3:<input type="text" name="postan3"/><br /> <input type="hidden" name="user_id" value="<?php echo $_SESSION['user_id'];?>"/> <input type="submit" value="submit"> </form>
and here is my newPoll.php(which might look ugly)
<?php include'init.php';?>
<?php
$postTitle=$_POST['title'];
$user_id=$_POST['user_id'];
$postanswer1=$_POST['postan1'];
$postanswer2=$_POST['postan2'];
$postanswer3=$_POST['postan3'];
$sql = "INSERT INTO `polls` (title, user_id) VALUES ('$postTitle','$user_id')";
$result = mysql_query($sql);
if(!$result)
{
echo("unable to input poll");
}
else
{
echo("input succeded");
}
header('Location:profile.php');
?>
any help would be great....the first insert is working but i dont know were to go after that...
This post has been edited by rjclancy: 22 September 2012 - 08:36 AM

New Topic/Question
Reply



MultiQuote







|