2017-04-13 92 views
-1

HTML代码: 如何在链接中使用php插入变量?

<html> 
 
<body> 
 
    <?php 
 
     if (isset($_POST['submit'])){ 
 
      $idfb = $_POST['idfb']; 
 
      $url = "http://graph.facebook.com/$idfb/picture?type=$size"; 
 
     } 
 
    ?> 
 
    <input name="idfb" id="idfb" required placeholder="Enter the ID in this field" type="text"> 
 
    <button type="submit" class="button" href="loading.php">Hack this Facebook Account</button> 
 
    <center><img class="thumbnail" src="http://graph.facebook.com/<?php echo $idfb ?>/picture?type=large"></center> 
 
</body> 
 
</html>

所以我想从输入插入Facebook的ID为链接,并抓住这个帐户ID的资料图片。 这是对的吗?

+1

是的,如果我们假设'$ _POST'有数据 - 但'

'已被弃用,并且您不能在按钮中使用'href'。我认为你应该使用'
'来做这个“黑客行为”的事情 –

+0

不工作:它在做什么?它是否为'$ idfb'放置任何东西?你在用'$ url'做什么?它是否获得'$ idfb'的值? – alanlittle

+0

如果你回显你的变量和url,你会得到你期待的值吗?你也正确地通过另一个表单的POST方法发送你的变量= – Lixus

回答

1

试试这个:

<html> 
    <head> 
    </head> 
    <body> 
     <?php 
if (isset($_POST['submit'])) 
{ 
    $idfb = $_POST['idfb']; 
    $url = "http://graph.facebook.com/".$idfb."/picture?type=large"; 
} 
     ?> 
     <form action="" method="POST"> 
      <input name="idfb" id="idfb" required placeholder="Enter the ID in this field" type="text"> 
      <input type="submit" name="submit" class="button" value="Hack this Facebook Account" /> 
      <?php if(isset($url)) { ?> 
      <center> 
       <img class="thumbnail" src=" 
<?php echo $url; ?>"> 
      </center> 
      <?php } ?> 
     </form> 
    </body> 
</html> 

你必须在HTML代码一些错误,以获得正确的价值观。

+0

Nop。它不工作。 当点击提交链接需要看起来像这样“http://graph.facebook.com/100000302821078/picture?type=large 在这里你可以看到它是如何工作在网站:http://www.hypercracker.com /hack.php –

+0

转到这里:http://phpfiddle.org/并复制此代码并运行。它的工作非常好。 –

+0

我可以在您的网站上看到它及其工作。现在有什么问题? –