PHP 从 While 语句发送 ID 到弹出表单 [英] PHP Send ID from While statement to popup form

查看:25
本文介绍了PHP 从 While 语句发送 ID 到弹出表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从 mysql 数据库中提取并使用while"语句显示的数据列表;这一切都很好.

当用户单击电子邮件"链接时,显示的项目之一旁边会出现一个弹出表单,其中包含通过电子邮件将项目详细信息发送给朋友的想法.

现在这一切都很好,但我似乎无法在按下链接时将正确的项目数据发送到表单.我猜这可能是因为它在 php 之外,但我不希望 while 语句中包含相同形式的多个实例.事实上,只有一种形式,我只需要能够在按下电子邮件链接时将项目 ID 发送给它.

非常感谢任何帮助,S.

(下面精简代码)

电子邮件

';}?><div id="sheet" class="rounded"><!--{{{ pane1 --><div class="pane" id="pane1"><h4>通过电子邮件将房产详情发送给朋友</h4><p>您已选择转发 <?php echo $_GET['title']; 的详细信息?>给朋友.</p><p>请填写以下表格</p><form class="rounded" id="email-form" method="post" action="<?php echo $pageLink; ?>"><!-- 表单进入这里--></表单>

<!--}}}-->

解决方案

应该

<?php $_GET['title'] ?> 应该是

还有其他地方.您需要将值回显到输出 (HTML) :)

I hava a list of data pulled in from a mysql database and displayed using the 'while' statement; which all works great.

When a user clicks on the 'email' link, next to one of the displayed items, a popup form appears, with the idea of emailing/sending the item details to a friend.

Now this all works great, but I can't seem to send the correct items' data to the form when the link is pressed. I'm guessing it could be because it's outside of the php but I don't want multiple instances of the same form being included in the while statement. As it is, there is only one form, I just need to be able to send the items id to it when the email link is pressed.

Any help greatly appreciated, S.

(stripped down code below)

<?php                   
    $query = mysql_query("select * from istable where categoryID = '1'");       
    while ($result = mysql_fetch_array($query)) {               
    echo '<h4>'.$result['title'].'</h4>
    <p>'.substr($result['descrip'],0,408).'... <a href="'.$wwwUrl.'/p/'.$result['categoryID'].'-'.$result['title'].'.php""><strong>Read more</strong></a></p>

    <div class="details">       
        <a href="#" rel="#sheet" class="see"><img src="'.$wwwUrl.'/images/email-icon.gif" width="23" height="23" alt="Email" /> Email</a>
        </div>';        
    } 
?> 

      <div id="sheet" class="rounded">
      <!--{{{ pane1 -->
          <div class="pane" id="pane1">

          <h4>Email Property Details to a Friend</h4>            
          <p>You have selected to forward the details of <?php echo $_GET['title']; ?> to a friend.</p>
          <p>Please fill out the following form</p>

              <form class="rounded" id="email-form" method="post" action="<?php echo $pageLink; ?>"> 
              <!-- form goes in here -->                 
              </form>   
          </div>
          <!--}}}-->                
      </div>

解决方案

<?php $pageLink; ?>

Should be

<?php echo $pageLink ?>

<?php $_GET['title'] ?> should be <?php echo $_GET['title']; ?>

And everywhere else. You need to echo the value to the output (HTML) :)

这篇关于PHP 从 While 语句发送 ID 到弹出表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
PHP最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆