PHP data taken from one MySQL table, displayed to user and than new data plus this data being written to new table
O开发者_如何学PythonK that probably sounded a bit confusing but what I have is a table that spits out courses locations and dates depending on what the user chooses. I than want the user to go through the fields and than on the 3rd submit button I have the course information displayed to them. I'm asking how in php i can take the echo from the first query and use that to upload it to the other table. Would I just be using MySQL Links?
If you have multiple pages, you can use $_SESSION
variables to store the data for when you're ready for it.
If you have one page, with multiple forms, you can use <input type='hidden' />
fields to hold the data until you're ready for it (it will be stored in $_POST
each time you submit the form).
Then, when you're ready, pull the info out of the $_SESSION
or $_POST
data and run your query.
For the $_POST solution:
<form action='' method='post' >
<input type='hidden' name='data1'
value="<? if(isset($_POST['data1'])) { echo $_POST['data1']; } ?>"
<input type='hidden' name='data2'
value="<? if(isset($_POST['data2'])) { echo $_POST['data2']; } ?>"
<input type='hidden' name='data3'
value="<? if(isset($_POST['data3'])) { echo $_POST['data3']; } ?>"
</form>
<?
if(isset($_POST['data1'] && isset($_POST['data2'] && isset($_POST['data3']) {
//Run your query, echo results
}
?>
精彩评论