0
我剛創建了一個簡單的Facebook應用程序。我想添加一個簡單的HTML表單,將值發佈到同一個文件。我寫了下面的代碼,但它不起作用。如何在fb應用程序中發佈和獲取html格式的數據
當我在表單的文本框中輸入內容並點擊提交時,頁面會重新加載,但它沒有得到任何值。
我無法弄清楚如何將數據發佈到佈局頁面上的fb應用程序。如果你能幫我修復我的代碼,我將不勝感激。謝謝。
<?php
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => '229924173724291',
'secret' => '79e2bdaaa52bb3b80ea2f5e4c0f20d3e',
));
$user = $facebook->getUser();
if ($user) {
$me = $facebook->api('/me');
} else {
$loginUrl = "https://www.facebook.com/dialog/oauth?client_id=229924173724291&redirect_uri=https://apps.facebook.com/tnxkapp/&scope=publish_stream";
echo "<script>top.location.href=\"{$loginUrl}\"</script>";
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<? print($_POST[name]); ?>
<form action="https://apps.facebook.com/tnxkapp/" method="post">
<input type="text" name="name" value="<?php print($name); ?>" />
<input type="submit" name="submit" value="submit"/>
</form>
</body>
</html>