PHP with some FBML issue

Hey. I will post my code and try to explain the issue i am having.

define('FB_ROOT', "");
define('HTML_ROOT', "");
define('APP_ID', "xxxxxxxxxxxxx");
define('APP_SECRET', "xxxxxxxxxxxxxxxxxxxxxxxxx");

function fb_root($url="") {
	return FB_ROOT . $url;

function html_root($url="") {
	return HTML_ROOT . $url;

function redirectToCanvas() {
	header('Location: '.fb_root());


require 'facebook.php';

$facebook = new Facebook(array(
  'appId'  => APP_ID,
  'secret' => APP_SECRET,
  'cookie' => true

$debug = false;

if ($facebook->getSession() && $debug == false) {

	// User is logged in and authorized, let's party.

	// Get friends list of current user
	$call = $facebook->api('/me/friends');
	$friends_list = $call['data'];
	// Get user information of current user
	$call = $facebook->api('/me');
	$my_info = $call;
	$user = $facebook->getUser();

<h3>By: <a href=""></a> - visit us today!</h3>
<p>Free personalised animated e-cards for all occassions</p>

} else {

	$params = array(
	$redirect = $facebook->getLoginUrl($params);
	echo '<fb:redirect url="' . $redirect . '">';


<fb:swf swfbgcolor="ffffff"  swfsrc='' width='380' height='250' />

<form method="post" onsubmit="return validateFormOnSubmit(this)" action="birthdayPreview.php">
    <p>Receivers Name<a> 
    <input type="text" name="receiver" size="30" maxlength="35" /></a></p>
    <p>Senders Name<a> 
    <input type="text" name="sender" size="30" maxlength="35" /></a></p>
    <p><input type="submit" value="Preview"/></p>

content="Send an E-Card to your friends. <?php echo htmlentities("<fb:req-choice url=\\"\\" label=\\"Authorize My Application\\"") ?>" > 
<fb:multi-friend-selector showborder="false" actiontext="Invite your friends to use tester."> 
<fb:comments xid="graphapi_comments" canpost="true" candelete="false" returnurl="<?=fb_root()?>">
<fb:title>Talk about this application</fb:title>

<center><img src="" alt="Free Hit Counter" border="0" ></center>

I dont know if anyone knows much FBML, but hopefully this is more a php issue. Basically, as it stands, in my form I have the action set to call up birthdayPreview.php. However, whenever submit is pushed, it seems to call up index.php. Can anyone see any reason why this might be?


Yup that action does make the difference there
i have not gone through your whole code but

The place where a user gets redirected after submitting the form through the fb:request-form-submit button or when they click Skip this Step. By default the user is directed to ‘‘Note: This default behavior may not be preserved.’’


FBML has been deprecated.

not very helpful, but fyi yo

I don’t know either FB or PHP but… your form action is correct. Alone, this form would call birthdayPreview.php (unless the server had a really stupid redirect like ^(.*)$ index.php/$1 [L] or something (who knows?).

But, after your form, you have this:



I can’t read what that’s doing, but doesn’t it override your form’s own action?

As a side note, why are there anchors wrapping your inputs? And where are the form labels?