我有一个问题$_GET
。当我单击提交按钮时,它不会读取来自我的第一页 php 的“id”。这是 id 值来自的链接,<?php echo $content."<p><a href='post.php?id=$pid'>Comment.</a>"?></p>
但是当我尝试运行echo $_GET['id'];
它时,它的工作表明它具有价值。
<?php
if (isset($_GET['id'])) {
$c = $_GET['id'];
}
mysql_connect("localhost","root","");
mysql_select_db("blog");
?>
<html>
<head>
<body background="u.jpg">
<center>
<a href="register.php"><img src="1.jpg" width="100" height="50"/></a>
<a href="login.php"><img src="2.jpg" width="100" height="50"/></a>
<a href="index.php"><img src="3.jpg" width="100" height="50"/></a>
</center>
<center>
<title>Pinoy Blog</title>
</head>
<?php
if(isset($_POST['submit']))
{
$content = $_POST['content'];
mysql_query("INSERT INTO comment (comment,p_id) VALUE('$content','$c')");
echo '<a href="index.php">span style="font-size:26px;"><strong><span style="font-family: verdana, geneva, sans-serif; ">Success! Tignan ang post. </span></strong></span>.</a>
|| <a href="post.php">Magpost ulit? Click mo to.</a>';
}else{
?>
<form action='post.php' method='post'>
<span style="font-size:26px;"><strong><span style="font-family: verdana, geneva, sans-serif; ">Comment: </span></strong></span>
<textarea name='content' ></textarea><br />
<input type='submit' name='submit' value='POST!'/>
</form>
<?php
}
?>
<center>
</body>
</html>