我有这个代码:
<body>
<div class="header">
<?php if (isset($_SESSION['user_id']) && !isset($menu)) { ?>
<div class="menu_holder">
<ul>
<li>
<a href="<?php echo ADDRESS; ?>menu.php" class="green_link">
<img src="<?php echo IMAGES; ?>template/menu.gif" width="51" height="20" border="0" />
</a>
</li>
</ul>
</div>
<?php } ?>
<?php
if (!isset($plainHeader))
{
$plainHeader = " ";
?>
<img src="<?php echo IMAGES; ?>template/logo.gif" width="160" height="94" />
<?php
}
?>
</div>
<br/>
<?php $id_to = $user['profile_id_contact']; ?>
<div class="main_content">
<center>
<div class="innerContainer">
<span class="headings2">FREE CHAT CONTACTS</span>
<form id="message_area" style="display:none" method="post" action="<?php echo ADDRESS; ?>messageSent.php?id=<?php echo $id_to ?>">
<?php
if (count($users) > 0)
{
foreach ($users as $user)
{
//some php here
?>
<a href="#" class="charcoal_link" style="line-height: 20px;" onclick="showMessageArea(this); return false;" >
<?php echo $uniqueCode1?><span class="pink_text"><?php echo $uniqueCode2?></span><?php echo $uniqueCode3?>
</a>
<textarea name="message" rows="10" cols="20"></textarea>
<input name="Submit" type="submit" value="Send"></input>
<?php
}
}
?>
</form>
</div>
</center>
</div>
</body>
由于我的代码现在是表单标记,所以表单标记位于错误的位置,因为我的标记链接没有显示。我必须把表单标记放在哪里,这样当我点击任何uniquecode链接时,我就会在操作中传递正确的$id_to???当我在我的链接显示之后移动表单标记时,无论我点击哪个链接,它都会通过该操作传递第一个链接的$id_to。我还试图将$id_to作为一个隐藏字段传递给sumbit,但它仍然通过了第一个链接的id
请帮忙?我已经纠结了一段时间了。。。我无法通过JS重定向页面,因为这个网站是用于移动的,也就是mobi网站
请帮忙?我绝望了谢谢
如果我移动表单标签并使其如下:messageSent.php?id=">
并且我查看页面源$id_to包含正确的id,但是当我转到sentMessage.php时,由于sson,url中的id是不正确的
要将id传递到链接中的下一页,需要在url末尾添加"?id='.$id'"。
例如
<a href="<?php echo ADDRESS; ?>menu.php?id=5" class="charcoal_link" style="line-height: 20px;">
为了确保每个链接都是不同的,你可以右键单击并复制url进行双重检查。