2014-09-02 79 views
0

我試圖將目標URL($ url)的一部分加載到我的HTML頁面中,目前$ url頁面發回了名稱,模型,類型和自我重新計算工具 - 全部其中有一個HTML TR標籤。在使用PHP時省略HTML的一部分

一旦我從password.php發佈我的每日密碼比我的用戶點擊$ url來從它獲得他們的日常庫存,再次,我並不意味着是多餘的,但$ url本身是由我提供給我的我的客戶和我不希望我的用戶能夠看到該頁面上的所有鏈接 - 僅與他們的工作有關。

而不是我創建password.php有沒有辦法讓我從我的每日展望交換電子郵件中「收集」這個密碼並將其發佈到$ url的標題?

許多thx和我希望我足夠描述。

<html> 
    <head> 
     <title>Post Password</title> 
    </head> 
    <body> 
      <?php 
      $password = ""; 
      ?> 
      <form name="password" method="post" action="users.php"> 
       <table border="0" cellspacing="0" cellpadding="2"> 
      <tr> 
       <td>Paste the Daily Password</td> 
       <td><input type="text" maxlength=7 name="password"></td> 
      </tr> 
      <tr> 
       <td><input type="submit" value="Submit"></td> 
      </tr> 
       </table> 
       </form> 

    </body> 
</html> 




<html> 
    <head> 
     <title>First Page</title> 
    </head> 
    <body> 
      <?php 

      $url_append = "?secret="; 
      //$psk = $password; 
      $linktext = "Click here to get a Pre Shared Key"; 
      $password = $_POST["password"]; 


      $url = "http://example.subexample.xx.com/"; 
      $url .= $url_append; 
      $url .= $password; 
      $final_url = $url; 
      // end base users 
      ?> 

<!--I took this form below from the URL that my client host--> 
<!--His url have way more input than all_products--> 
<!-- but that's the only one that I want to echo for my employees to use --> 
<form name="form1" method="post" action="<?php echo htmlspecialchars($final_url);?>"> 
       <table border="0" cellspacing="0" cellpadding="2"> 
      <tr> 
       <td>Main Inventory</td> 
       <td><input type="text" maxlength=7 name="all_products"></td> 
      </tr> 

      <tr> 
       <td><input type="submit" value="Submit"></td> 
      </tr> 
       </table> 
       </form> 
    </body> 
</html> 

回答

0

要通過標題發送POST,請看this

對於省略HTML的部分,你可以使用替代語法這樣

<?php if ($a == 5): ?> 
<p>This will be omitted if condition is not true</p> 
<?php endif; ?> 

可用於for循環類似。

Read more關於替代語法。

+0

工程就像一個魅力!感謝一百萬 - 這是另外兩個令我困惑的問題。有沒有PHP功能,讓我「點擊」到我自己的電子郵件檢索每日庫存密碼? – 2014-09-03 19:50:54

+0

你必須看看你的郵件API,如果它有。 – lukadante3 2014-09-03 19:53:34