Multi-Thread Form Setup - tr3x86 - Jun 24th, 2009
I'm having trouble with a 3 page multi-form. Doesn't seem to carry information on to Form Tools to get past Step 3.
I've been messing with it for hours and I'm sure I'm missing something simple. Is there something wrong with the code?
Page 1:
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link media="all" rel="stylesheet" type="text/css" href="css/style.css" />
<title>BendPak Lead Generation</title>
<body>
<h1>Lead Generation<sup>beta</sup></h1>
<?php
require_once("global/api/api.php");
$fields = ft_api_init_form_page(1, "initialize");
$params = array(
"submit_button" => "next_page",
"next_page" => "/lead-details.php",
"form_data" => $_POST
);
ft_api_process_form($params);
?>
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" class="lead-form">
<div id="buyer_information">
<h2>Buyer Information</h2>
<fieldset>
<label>Name:</label>
<input type="text" name="name" maxlength="32">
<label>Company Name:</label>
<input type="text" name="company" maxlength="32">
</fieldset>
<input name="next_page" type="submit" />
</div>
</form>
</body>
</html>
Page 2:
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link media="all" rel="stylesheet" type="text/css" href="css/style.css" />
<title>Untitled Document</title>
<body>
<h1>Lead Generation<sup>beta</sup></h1>
<?php
require_once("global/api/api.php");
$fields = ft_api_init_form_page(1, "initialize");
$params = array(
"submit_button" => "next_page1",
"next_page" => "/comments-submit.php",
"form_data" => $_POST,
"no_sessions_url" => "/buyer-info.php"
);
ft_api_process_form($params);
?>
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" class="lead-form">
<div id="lead_details">
<h2>Lead Details</h2>
<fieldset>
<h3>Referral to BendPak</h3>
<label>If Internet Blog-Forum / Which One?</label>
<input type="text" name="blog" maxlength="32">
<label>If TV Show / Which One?</label>
<input type="text" name="tv" maxlength="32">
</fieldset>
<input name="next_page1" type="submit" />
</div>
</body>
</html>
Page 3:
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link media="all" rel="stylesheet" type="text/css" href="css/style.css" />
<title>BendPak Lead Generation</title>
<body>
<?php
require_once("global/api/api.php");
$fields = ft_api_init_form_page(1, "initialize");
$params = array(
"submit_button" => "submit",
"next_page" => "/thanks.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
?>
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" class="lead-form">
<h1>Lead Generation<sup>beta</sup></h1>
<div id="comments_submit">
<fieldset>
<h2>Add Comments & Submit</h2>
<label>Add comments pertaining to this lead:</label>
<textarea name="comments"></textarea>
<label>Add comments for the distributor:</label>
<textarea name="comments"></textarea>
</fieldset>
<input name="submit" type="submit" />
</div>
</form>
</body>
</html>
Any help is much appreciated.
Thanks,
Tyler
Please ignore me... just figured it out.
Funny how that happens.
RE: Multi-Thread Form Setup - Ben - Jun 27th, 2009
Hi Tyler,
Glad you figured it out!
Just one thing - make sure you include your PHP above the opening HTML. I'm actually surprised this is working for you! ft_api_process_form() uses a "header redirect" to go to the next page. Normally that only works if the HTML hasn't been outputted to the browser yet. Surprising!
- Ben
|