PHP with some FBML issue

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

<?php
define('FB_ROOT', "http://apps.facebook.com/tester/index.php/");
define('HTML_ROOT', "http://www.tester.com/facebook/");
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());
}
?>

<?php

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();
	
?>

<h1>tester.com</h1>
<h3>By: <a href="http://www.tester.com?">tester.com</a> - visit us today!</h3>
<hr/>
<p>Free personalised animated e-cards for all occassions</p>

<?php
	
} else {

	$params = array(
		'fbconnect'=>0,
		'canvas'=>1,
		'req_perms'=>'',
		'next'=>fb_root(),
		'cancel_url'=>fb_root()
	);
	
	$redirect = $facebook->getLoginUrl($params);
	
	echo '<fb:redirect url="' . $redirect . '">';
	
}

?>

<fb:swf swfbgcolor="ffffff"  swfsrc='http://www.tester.com/facebook/tester/Bcard2.swf' 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>
</form>

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

<center><img src="http://www.e-zeeinternet.com/count.php?page=444454&style=default&nbdigits=7" 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?

cheers

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

action
string
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 http://apps.facebook.com/yourapp/null. ‘‘Note: This default behavior may not be preserved.’’

http://developers.facebook.com/docs/reference/fbml/request-form

thanks

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:


</form>

<fb:fbml>
<fb:request-form
[b]action="index.php"[/b] 
method="POST" 
...

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?