Hi all im having a problem i simply want to submit a form and for that form to go to a page with the page id that is fetched from a table in my database, ive currently done this with in my website but not in a form.
Here is my form with a few my sql:
$sqltopics = "SELECT topic_id, topic_subject, topic_date, topic_cat FROM `forum_topics` WHERE topic_id = ". mysqli_real_escape_string($conn, $_GET['id']) or die(mysqli_error());
$resulttopics = $conn->query($sqltopics);
while($rowtopics = $resulttopics->fetch_array(MYSQLI_ASSOC))
{
$topicname = $rowtopics['topic_subject'];
$topicid = $rowtopics['topic_id'];
}
$sqlposts = "SELECT post_id, post_content, post_date, post_by FROM `forum_posts` WHERE post_topic = ". mysqli_real_escape_string($conn, $_GET['id']) or die(mysqli_error()); ;
$resultposts = $conn->query($sqlposts);
$row_cntposts = $resultposts->num_rows;
<form method="post" action="test.php?id=">
<input type="text" name="reply-content" maxlength="255" size="255" ><br />
<input type="submit" value="Submit reply" />
</form>
What im looking for is the "test.php?id=" to equal the topic_id which is $topicid.
I have previously done something like this like i said with href here is the example:
echo '<h3><a href="topic.php?id=' . $rowtopics['topic_id'] . '">' . $rowtopics['topic_subject'] . '</a></h3>';
This is on a different page but im sure you can see where im coming from. How can i put the variable in the form?
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…