【问题标题】:Facebook page tab application $_POST values do not setFacebook 页面选项卡应用程序 $_POST 值未设置
【发布时间】:2012-02-15 14:12:14
【问题描述】:

我有一个 facebook 应用程序,它由一个表单组成,我想将值存储在我的数据库中。 我的表单方法是 POST,但在操作方法中,我无法以我使用的表单发送任何数据。表格下方:

   <form enctype="application/x-www-form-urlencoded" action="take_test.php" method="POST">    
<table>
<tr>
<td style = "padding-top: 50px; padding-left: 44px; font-size: 13px; color: #50729F;" >          <span style = "font-weight:bold;"> some question?</span>  <br>

 <fieldset class='radios'>
 <label class='label_radio' for="radio-01"><input id="radio-01" type="radio" name='q1' value='1'> some answer</label>
 <label class='label_radio' for="radio-02"><input id="radio-02" type="radio" name='q1' value='2'> some answer 2</label>
 <label class='label_radio' for="radio-03"><input id="radio-02" type="radio" name='q1' value='3'> some answer3 </label>
 </fieldset>
 </td>

<input type="text" name="signed_request" value="<? echo $_REQUEST['signed_request']; ?>">

<input type="submit" class="input_but" value="submit" />
</form>

在 take_test.php 我有

   if ($_POST) { 

        $b = $_POST['q1'];  
    }

但它表示未定义索引'q1',因此未设置 $b。 有没有什么特殊的方法可以通过 Facebook 页面标签中的帖子发送数据?

谢谢

【问题讨论】:

  • 您在提交表单时是否选择了其中一个单选按钮?
  • 我不是 100% 确定,因为我不记得曾经使用过单选按钮(首选下拉菜单),但也许是因为它们都具有相同的名称?
  • 不,它们是无线电组,所以它们的名称相同
  • 你有两个input id="radio-02"
  • 谢谢 DMCS。还是没有解决问题

标签: php facebook facebook-apps


【解决方案1】:

正如 DMCS 所述,您有两个具有相同 ID 属性的输入元素。

 <label class='label_radio' for="radio-02"><input id="radio-02" type="radio" name='q1' value='2'> some answer 2</label>
 <label class='label_radio' for="radio-03"><input id="radio-02" type="radio" name='q1' value='3'> some answer3 </label>

此外,第三个单选按钮标签是“代表”一个不存在的 ID。 Facebook 可能有严格的 HTML 规则,这些规则会阻止表单在出现此类错误时正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-25
    • 1970-01-01
    • 2018-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多