flapietoetoe
New Member
- Messages
- 226
- Reaction score
- 0
- Points
- 0
Hi:
Im making this forum by myself, but I'm experiencing some troubles , with the part that users can post their own message:
this is what I have:
The problem is : i think... that the $_GET['id'] doesnt come through.
It is submitted through get like this:
www.somehost.whatever/forum/functions/postmsg.php?id=whatever
Im making this forum by myself, but I'm experiencing some troubles , with the part that users can post their own message:
this is what I have:
PHP:
<?php
//includes
include("dbconnect.php");
include("config.php");
$topic_id=$_GET['id']
?>
<?php if(!isset($_POST['Submit']))
{ ?>
You have chosen to post a reply to this topic. Fill in your name , then the message you want to post. Then press submit. <br>
<br>
<form name="form1" method="post" action="postmsg.php">
<table width="712" border="0">
<tr>
<th width="139" scope="col">Poster:</th>
<th width="62" scope="col"> </th>
<th width="497" scope="col"><input name="poster" type="text" size="30"></th>
</tr>
</table>
<table width="884" border="0">
<tr>
<th scope="col"> </th>
<th scope="col">Message:</th>
<th scope="col"> </th>
</tr>
</table>
<table width="884" height="310" border="0">
<tr>
<th width="135" scope="col"> </th>
<th width="607" scope="col"><textarea name="message" cols="99" rows="17"></textarea></th>
<th width="128" scope="col"> </th>
</tr>
</table>
<table width="884" border="0">
<input name="" type="hidden" value=<?php echo $_GET['id']; ?> />
<tr>
<th scope="col"> </th>
<th scope="col"><input type="submit" name="Submit" value="Submit"></th>
<th scope="col"> </th>
</tr>
</table>
<p> </p>
<p> </p>
</form>
<?php };?>
<?php
if(isset($_POST['Submit']))
{
//Make sure the user cannot execute querys with the form.
$poster=addslashes($_POST['poster']);
$message=addslashes($_POST['message']);
$id=addslashes($_POST['id']);
//Post the message
$SQL_statement="INSERT INTO messages (topic_ID, bericht_poster, bericht) VALUES (" . $id . "," . $poster . "," . $message . ")";
$resultset=mysql_query($SQL_statement);
echo "Your message has been placed Please click " . "<a href=\"http://" . $_SERVER['HTTP_HOST'] . $forumdir . "/functions/showtopic.php?id=" . $_POST['id'] . "\"> here</a> and go back to the page you came from";
echo "<br>" . "id= " . $id;
};
?>
The problem is : i think... that the $_GET['id'] doesnt come through.
It is submitted through get like this:
www.somehost.whatever/forum/functions/postmsg.php?id=whatever