xxreenaxx1 Posted February 14, 2011 Share Posted February 14, 2011 I am echo information from the database now I would like to insert these to different table. I am using checkbox to echo and when the user click on the one of these the result should be saved to a new table. So far I have <?php include 'Database/connection.php'; include 'Database/question_sql.php'; while($info = mysql_fetch_array( $sql )) { echo "{$info['Que_Question']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice1[]\" value=\"{$info['Que_Choice1']}\" /> "; echo "{$info['Que_Choice1']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice2[]\" value=\"{$info['Que_Choice2']}\" /> "; echo "{$info['Que_Choice2']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice3[]\" value=\"{$info['Que_Choice3']}\" /> "; echo "{$info['Que_Choice3']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice4[]\" value=\"{$info['Que_Choice4']}\" /> "; echo "{$info['Que_Choice4']} <br />\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/227607-how-to-echo-and-insert-at-the-same-time/ Share on other sites More sharing options...
zenlord Posted February 14, 2011 Share Posted February 14, 2011 Those 'inputs' that you echo should be part of a new <form method="post" action=""> with action set to the php-script to handle the POST-vars and insert them into a table. Link to comment https://forums.phpfreaks.com/topic/227607-how-to-echo-and-insert-at-the-same-time/#findComment-1173964 Share on other sites More sharing options...
xxreenaxx1 Posted February 14, 2011 Author Share Posted February 14, 2011 but I am getting these echo's from another table. Can I do that? Link to comment https://forums.phpfreaks.com/topic/227607-how-to-echo-and-insert-at-the-same-time/#findComment-1173967 Share on other sites More sharing options...
zenlord Posted February 15, 2011 Share Posted February 15, 2011 of course. Just try it out and you'll see. Link to comment https://forums.phpfreaks.com/topic/227607-how-to-echo-and-insert-at-the-same-time/#findComment-1174431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.