2011-02-01 63 views
0

我哈瓦數據的列表,從MySQL數據庫中拉出,並使用「而」語句顯示發送ID;這一切都很好。PHP從while語句彈出形式

當「郵件」鏈接,用戶點擊,旁邊顯示的項目,會出現一個彈出的形式之一,電子郵件/發送項目詳細信息的朋友的想法。

現在,這一切的偉大工程,但我似乎無法按下連接時,正確的項目的數據發送到窗體。我猜這可能是因爲它是PHP之外,但我不想被包含在while語句相同的形式的多個實例。實際上,只有一種形式,我只需要能夠在按下電子郵件鏈接時將項目ID發送給它。

任何幫助不勝感激,S.

(剝離下來下面的代碼)

<?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> 
+0

感謝dnagirl :) – ss888 2011-02-01 18:08:11

回答

1
<?php $pageLink; ?> 

應該是

<?php echo $pageLink ?> 

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

和其他地方。 您需要將該值回顯到輸出(HTML):)

+0

只需注意:在HTML中重新顯示用戶輸入時,使用htmlspecialchars()輸出變量以防止XSS注入非常重要。 ?即, 2011-02-01 18:06:45