justlukeyou Posted March 10, 2011 Share Posted March 10, 2011 I am entering a question and notes into one table and creating an ID number in Table 1: $qid (Question ID) $question $notes I am then entering an answer and creating an ID for the answer which sites next to question ID in Table 2: $aid (Answer ID) $answer I am now trying to transfer the Question ID into Table 2. I am currently trying to do this as a hidden string: <input name="category" type="hidden" value="$qid" id="qid" > Does any one have any advice on how I can use two fields. Can I display or insert data with the same php script? Link to comment https://forums.phpfreaks.com/topic/230270-working-with-two-tables/ Share on other sites More sharing options...
justlukeyou Posted March 10, 2011 Author Share Posted March 10, 2011 Hi, I've now got this working and its not an issue of two tables. But Im now stuck on entering a string in a hidden value in a form. I am trying to transfer $qid as a hidden value in a form. Does anyone know if this is possible? $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $category = $row['category']; $notes = $row['notes']; $question = $row['question']; $qid = $row['qid']; echo " <a href= 'http://www.ukhomefurniture.co.uk/test/homesoeasy/question.php?question=$qid'>$question </a></br> $notes</br> category: <a href= 'http://www.ukhomefurniture.co.uk/test/homesoeasy/category.php?category=$category'>$category</a></br></a></br> Question ID: $qid </br>"; } // close connection mysql_close(); ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td><form name="form1" method="post" action="phpviewanswerquestion.php"> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td colspan="3"><strong>Your Answer</strong></td> </tr> <tr> <td width="71">Answer</td> <td width="6">:</td> <td width="600" height="50"><input name="answer" type="text" id="answer"></td> <tr> <td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td> <input name="ansqid" type="hidden" value=" <?php $qid ?>" id="ansqid" > </tr> </table> </form> </td> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/230270-working-with-two-tables/#findComment-1185839 Share on other sites More sharing options...
AbraCadaver Posted March 10, 2011 Share Posted March 10, 2011 Sure, what's the problem? Link to comment https://forums.phpfreaks.com/topic/230270-working-with-two-tables/#findComment-1185852 Share on other sites More sharing options...
justlukeyou Posted March 10, 2011 Author Share Posted March 10, 2011 I have $qid on one page and I am trying to post it to another page via a hidden type This doesn't work <input name="ansqid" type="hidden" value=" <?php $qid ?>" id="ansqid" > or <input name="ansqid" type="hidden" value="$qid" id="ansqid" > but this does <input name="ansqid" type="hidden" value="123456789" id="ansqid" > Link to comment https://forums.phpfreaks.com/topic/230270-working-with-two-tables/#findComment-1185856 Share on other sites More sharing options...
AbraCadaver Posted March 10, 2011 Share Posted March 10, 2011 <input name="ansqid" type="hidden" value="<?php echo $qid; ?>" id="ansqid" > Link to comment https://forums.phpfreaks.com/topic/230270-working-with-two-tables/#findComment-1185867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.