fb friend selector & php POST formular not working properly
Hey guys, I've used the search as well so I am confident in asking the question here without doing anything wrong :P
Recently I was developing for fun and learning purposes another Facebook application! Basically what I want it to do is:
1.) You choose something to click on 2.) You choose from the fb friend selector formular one friend
and then the app does a wall posting with the item chosen at point 1 on the wall of the friend chosen from point 2!
The thing is, i created a php post formular and had the fb friend selector in it like that:
<form action="send.php" id="testForm" method="post">
[blah blah the items to choose]
<fb:serverfbml style="width: 240px; height: 700px;">
<script type="text/fbml">
<fb:fbml>
<fb:friend-selector uid="$user" name="uid" idname="uid2"/>
</fb:fbml>
</script>
</fb:serverfbml>
<input class="inputbutton" style="cursor: pointer;" name="do_it" value="submit" type="submit">
</form>
S开发者_开发技巧o the thing is, when my send.php file only contains for example:
<?php
[facebook api shit]
if($_POST[do_it]=="submit"){
echo $_POST[$user];
}
or i replaced it with echo $_POST['uid'] or $_POST['uid2']
and none of them showed me a value at all
so where is the bug??
fb:serverfbml creates an iframe, so because your form is outside, it won't send anything inside the fb:serverfbml tag. You need to do something like this:
<fb:serverfbml width="615">
<script type="text/fbml">
<form name="form" action="http://www.remy-mellet.com/remote/fb/reverse/temp.php" id="form">
<fb:friend-selector uid="797350112" name="uid" idname="friend"/>
<INPUT type="submit" value="test">
</form>
</script>
</fb:serverfbml>
Parameters received:
<?php
print_r($_POST);
print_r($_GET);
?>
精彩评论