The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/showthread.php 26 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/showthread.php 137 forum_permissions
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Trying to access array offset on value of type null - Line: 488 - File: inc/db_mysqli.php PHP 8.1.31 (Linux)
File Line Function
/inc/db_mysqli.php 488 errorHandler->error
/showthread.php 722 DB_MySQLi->fetch_field
Warning [2] Undefined property: MyLanguage::$ratings_update_error - Line: 5 - File: showthread.php(732) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(732) : eval()'d code 5 errorHandler->error
/showthread.php 732 eval
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 784 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 784 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 784 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 784 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 784 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 784 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "invisible" - Line: 1506 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1506 errorHandler->error
Warning [2] Undefined variable $threadnotesbox - Line: 30 - File: showthread.php(1533) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 30 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $addremovesubscription - Line: 79 - File: showthread.php(1533) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 79 errorHandler->error
/showthread.php 1533 eval



FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some Demo Coded Pages would be nice
#1
I have finally gotten the API functions working in a test localhost environment.

But the way the documentation is written leaves an actual form as a "theoretical" construct codewise. It would have been helpful to actually include some fully coded samples as demo examples of a properly coded form.

I have the API functions, for the most part, working where the external form page is being written into the FormTools database.

I have a form page and a thank you page written in php. When the form page is filled out and the Submit button is used the data does wind up inserted into the Form Tools database.

But on the Submit action the form "disappears" and I have nothing but a white page that does not step through to the "thank you" page where the session close code is waiting.

I have to manually enter the url of the thank you page to close the session and be able to test the form page again.

I am going to include the code for the 1) external form using the API and 2) the thank you page that never shows up.

Hopefully, someone can point out my coding error.

The form is identified as ID "6" in my Admin panel. Status is ONLINE
(accepting submissions). Form type: External
All Clients can Access
Submission type. Code (API)
Form Url checks out correctly
Access: Public

PHP Code:
<?php
require_once("formtools/global/api/api.php");
 
$fields ft_api_init_form_page(6);
$params = array(
  
"submit_button" => "Send_Guess",
  
"next_page" => "thanks.php",
  
"form_data" => $_POST,
  
"finalize" => true
    
);
ft_api_process_form($params);

?>
 

<!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" />
<title>Vipcontest Guess Form</title>
</head>

<body>
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
  <p>id
    <input type="text" name="id" id="id" />
  </p>
  <p>First Name
    <input type="text" name="fname" id="fname" />
  </p>
  <p>Last Name
    <input type="text" name="lname" id="lname" />
  </p>
  <p>City
    <input type="text" name="city" id="city" />
  </p>
  <p>Email
    <input type="text" name="email" id="email" />
  </p>
  <p>First Guess
    <input type="text" name="guess1" id="guess1" />
  </p>
  <p>Second Guess
    <input type="text" name="guess2" id="guess2" />
  </p>
  <p>Third Guess
    <input type="text" name="guess3" id="guess3" />
  </p>
  <p>Last Guess Time
    <input type="text" name="modified" id="modified" />
  </p>
  <p>I.P. Adress
    <input type="text" name="ip" id="ip" />
  </p>
  <p>Password
    <input type="text" name="password" id="password" />
  </p>
  <p>&nbsp;</p>
  <p>Submit
    <input type="submit" name="Send Guess" id="Send Guess" value="Submit" />
  </p>
</form>
</body>
</html> 

This test form DOES Insert the Field values into my Form Tools form.
But this page called "vipcontestform.php" turns white with no html code generated past the API code at the top. It does not redirect to the "thanks.php" test page codes as such below:

PHP Code:
<?php require_once('formtools/global/api/api.php');

$fields ft_api_init_form_page(6);
ft_api_clear_form_sessions();
?>
<!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" />
<title>VipContest Thanks</title>
</head>

<body>
Hey, thanks!

</body>
</html> 

This even sends emails. But I cannot get the form pages to step through after submission to the thanks.php which kills the user session.

I'd appreciate some eagle eyes looking at this!
Reply
#2
It took me awhile to find this old post, so I don't blame you for not searching the forums. Can you try this and see what it says?

(May 5th, 2011, 1:12 PM)Ben Wrote: Also one tip I should have mentioned: if you haven't already done so, add this to your /global/config.php file:

PHP Code:
$g_default_error_reporting 2047

That will output all errors/warnings/notices that occur. You should probably remove it when you're done, but I find it invaluable for debugging.
- Ben

Also - the name and id attributes of your submit button do not match what you've told FormTools. That could be causing an error. You told FT it was "Send_Guess" - but you've got the HTML as "Send Guess"
Not a FT employee, just a FT user lending a hand. If I've been helpful, please rate.

[Image: giraffe_long_85.gif]
Reply
#3
Thank you for your suggestions, Ben and Michatmaster7, but I have exactly the same problem as before.

Ben: that line into my config.php file as in

$g_table_prefix = "ft_";
$g_default_error_reporting = 2047;

does not produce visible errors. It makes no difference. I get the same white page output with no html code produced after the Submit button is clicked.

Whatever error I would hope to see made visible does not happen. The browser stays on the same external form page only the page this time around is empty of all code.

And it never steps to the the "thank you" page -- my test "thanks.php"

I have tried giving this page the full http url but it makes no difference in the outcome.

I am still hung up on the original form page after Submit except that it does not produce html code at all.

HOWEVER, the form gets Written and it is Sending Emails from the Template I set up! So, the Email configuration seems to be working perfectly.

I just need to get this re-direct to a Thank you page or Any page working.
Reply
#4
Have you changed the submit button code as I suggested?

Side note: the attribute value for the form tag's method attribute should be lowercase to comply with XHTML.

Also - often times this can happen if there is a coding problem with one of the HTML e-mail templates you're using. Can you post that code here, as well?
Not a FT employee, just a FT user lending a hand. If I've been helpful, please rate.

[Image: giraffe_long_85.gif]
Reply
#5
Hello michatmaster7, thanks for taking a look again and responding.

Yes, you are correct about the matching of the Submit button names. Actually, in the last version of the code they do match.

And in subsequent testing I simply removed spacing so that there was no need to place an Underline as a gap filler.

So the the name for the Submit button became "sendguess".

I have just gone through all the steps for another form and it is now Complete and Online.

After going through the Initialization process I cam back and changed the PHP head in my new form just called "vipform.php"

<?php
require_once('formtools/global/api/api.php');
$fields = ft_api_init_form_page(7);
$params = array(
"submit_button" => "sendmyguess",
"next_page" => "nothanks.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);

?>


Just as extra information I added the form name and id from the Form settings Name itself:

<form name = "BigContest" id= "BigContest" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

The "no thanks" PHP file is renamed and I use this code as the Submit

<p>Submit
<input type="submit" name="sendmyguess" id="sendmyguess" value="Submit" />

Same old nothing.

This new form submits to itself, stays there, does not move on to "nothanks.php".

What I notice is that FormTools wants to use the Submit Button value and create and save a field value for it.

I removed this field from my previous Form.

This time, in this new test form I KEPT the SUBMIT field and am allowing the Post to send "Submit" to a field for each Post.

Here's the html email template from this new form:

<p>
There has been a submission made through your form, {$FORMNAME}:
</p>

<table cellpadding="0" cellspacing="1">
<tr>
<td style="font-weight: bold">ID</td>
<td>{$SUBMISSIONID}</td>
</tr>
{if $ANSWER_id}
<tr>
<td style="font-weight: bold">Id</td>
<td>{$ANSWER_id}</td>
</tr>
{/if}
{if $ANSWER_fname}
<tr>
<td style="font-weight: bold">Fname</td>
<td>{$ANSWER_fname}</td>
</tr>
{/if}
{if $ANSWER_lname}
<tr>
<td style="font-weight: bold">Lname</td>
<td>{$ANSWER_lname}</td>
</tr>
{/if}
{if $ANSWER_city}
<tr>
<td style="font-weight: bold">City</td>
<td>{$ANSWER_city}</td>
</tr>
{/if}
{if $ANSWER_email}
<tr>
<td style="font-weight: bold">Email</td>
<td>{$ANSWER_email}</td>
</tr>
{/if}
{if $ANSWER_guess1}
<tr>
<td style="font-weight: bold">Guess1</td>
<td>{$ANSWER_guess1}</td>
</tr>
{/if}
{if $ANSWER_guess2}
<tr>
<td style="font-weight: bold">Guess2</td>
<td>{$ANSWER_guess2}</td>
</tr>
{/if}
{if $ANSWER_guess3}
<tr>
<td style="font-weight: bold">Guess3</td>
<td>{$ANSWER_guess3}</td>
</tr>
{/if}
{if $ANSWER_modified}
<tr>
<td style="font-weight: bold">Modified</td>
<td>{$ANSWER_modified}</td>
</tr>
{/if}
{if $ANSWER_ip}
<tr>
<td style="font-weight: bold">Ip</td>
<td>{$ANSWER_ip}</td>
</tr>
{/if}
{if $ANSWER_password}
<tr>
<td style="font-weight: bold">Password</td>
<td>{$ANSWER_password}</td>
</tr>
{/if}
{if $ANSWER_sendmyguess}
<tr>
<td style="font-weight: bold">sendmyguess</td>
<td>{$ANSWER_sendmyguess}</td>
</tr>
{/if}
<tr>
<td style="font-weight: bold">Last modified</td>
<td>{$LASTMODIFIEDDATE}</td>
</tr>
<tr>
<td style="font-weight: bold">IP Address</td>
<td>{$IPADDRESS}</td>
</tr>
</table>

<p>
Submission made: {$SUBMISSIONDATE}
</p>
Reply
#6
So, I finally took this online and it WORKS! Even though my Test Email function on my localhost worked, apparently something in the FormTools configuration can't handle localhost email.

The localhost environment always sends emails correctly out to the internet but the Test Email function in FormTools Settings is apparently disconnected from the actual process for a Live External Form. Once I installed this ONLINE at a server then the form advanced to the "thank you" page!

NOW, I am trying to solve an API Form validation problem.

In a nutshell: As soon as I added PHP Validation rules into my form that specified that 3 of my fields had to have a length of 6 characters but no greater than 6 then the PHP errors returned IF any of those fields were NOT filled out.

But, I am not running a REQUIRED rule on those fields. I simply want any values, if entered, into those 3 fields to be no less than 6 characters in length and no more than 6 characters in length.

But this Rule is now making each of those fields REQUIRED on this form submission.

What the PHP should be saying as part of the rule is that "IF there is a Posted Value for this field then the Following Rule on Minimum and Maximum Length ought to be Applied ELSE this particular Rule does not run for this field".


Here is the script that is now Reporting an Error when No Value is Posted into the Guess1, Guess2, Guess3 field. It also contains a Login test script at the top.

PHP Code:
<?php
require_once("formtools/global/api/api.php");
$fields ft_api_init_form_page(1);
// validation time!
$errors = array();
if (isset(
$_POST['sendguess']))
{
$rules = array();
$rules[] = "required,email,Please enter your email address.";
$rules[] = "valid_email,email,Please enter a valid email address.";
$rules[] = "digits_only,guess1, Please only enter numbers with no commas.";
$rules[] = "length=6-7,guess1, No less or more than 6 numbers -- Guess 1 number is greater than 6 digits -- please keep your guess within 6 digits total.";
$rules[] = "digits_only,guess2, Please only enter numbers with no commas.";
$rules[] = "length=6-7,guess2, No less or more than 6 numbers -- Guess 2 is greater than 6 digits-- please keep your guess within 6 digits total.";
$rules[] = "digits_only,guess3, Please only enter numbers with no commas.";
$rules[] = "length=6-7,guess3, No less or more than 6 numbers -- Guess 3 is greater than 6 digits-- please keep your guess within 6 digits total.";
  
$errors validate_fields($_POST$rules);
 
  
// no errors - great! Now we process the page. The ft_api_process_form does
  // the job of both updating the database and redirecting to the next page
  
if (empty($errors))
{
$params = array(
  
"submit_button" => "sendguess",
  
"next_page" => "thanks.php",
  
"form_data" => $_POST,
  
"finalize" => true
    
);
ft_api_process_form($params);
}
  
// it failed validation. Update $fields with the latest contents of the form data
  
else 
  {
    
$fields array_merge($_SESSION["form_tools_form"], $_POST);
  }
}
?>
<!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" />
<title>Vipcontest Guess Form</title>
</head>

<body>
<table width="85%" border="0" align="center" cellpadding="10">
  <tr>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;</th>
  </tr>
  <tr>
    <td colspan="2"><form action="http://www.mywebsite.com/formtools/modules/submission_accounts/login.php" method="post">
  <input type="hidden" name="form_id" value="1" />
  <input type="hidden" name="invalid_login_redirect_url" value="http://www.mywebsite.com/loginfail.php" />
  Email <input type="text" name="username" /><br />
  Password <input type="text" name="password" /><br />
  <input type="submit" name="login" value="LOGIN" /><br />
  <a href="http://www.mywebsite.com/formtools/modules/submission_accounts/forget_password.php">Forget your password?</a><br />
</form></td>
  </tr>
   <tr>
    <th scope="col"><?php
// if $errors is not empty, the form must have failed one or more validation 
// tests. Loop through each and display them on the page for the user
if (!empty($errors))
{
  echo 
"<div class='error'>Please fix the following errors:\n<ul>";
  foreach (
$errors as $error)
    echo 
"<li>$error</li>\n";
 
  echo 
"</ul></div>"
}
?></th>
    <th scope="col">&nbsp;</th>
  </tr>
  <tr>
    <td colspan="2"><form name = "Vipcontest" id= "Vipcontest" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
    <p>First Name
    <input name="fname" type="text" id="fname" value="<?=htmlspecialchars(@$fields["fname"])?>" />
  </p>
  <p>Last Name
    <input name="lname" type="text" id="lname" value="<?=htmlspecialchars(@$fields["lname"])?>" />
  </p>
  <p>City
    <input name="city" type="text" id="city" value="<?=htmlspecialchars(@$fields["city"])?>" />
  </p>
  <p>Email
    <input name="email" type="text" id="email" value="<?=htmlspecialchars(@$fields["email"])?>" />
  </p>
  <p>First Guess
    <input name="guess1" type="text" id="guess1" value="<?=htmlspecialchars(@$fields["guess1"])?>" />
  </p>
  <p>Second Guess
    <input name="guess2" type="text" id="guess2" value="<?=htmlspecialchars(@$fields["guess2"])?>" />
  </p>
  <p>Third Guess
    <input name="guess3" type="text" id="guess3" value="<?=htmlspecialchars(@$fields["guess3"])?>" />
  </p>
  <p>Password
    <input name="password" type="text" id="password" value="<?=htmlspecialchars(@$fields["password"])?>" />
  </p>
  <p>&nbsp;</p>
  <p>Submit
    <input type="submit" name="sendguess" id="sendguess" value="Submit" />

  </p>
</form>
    </td>
  </tr>
</table>


</body>
</html> 
Reply
#7
OKAY, another problem SOLVED.

I have made the PHP server side validation Conditional for the 3 fields that were giving me problems because attaching character length validation code to those 3 fields was making them Required.

I have modified the code to the following so that the form will allow the user to simply leave the fields blank when the form is processed after Submit using the external form API.

Here is the code that solves the problem for me.

PHP Code:
<?php
require_once("formtools/global/api/api.php");
$fields ft_api_init_form_page(1);
// validation time!
$errors = array();
if (isset(
$_POST['sendguess']))
{
$rules = array();
$rules[] = "required,email,Please enter your email address.";
$rules[] = "valid_email,email,Please enter a valid email address.";

  if(!empty(
$_POST['guess1'])) {
$rules[] = "digits_only,guess1, Please only enter numbers with no commas.";
$rules[] = "length=6-7,guess1, No less or more than 6 numbers -- Guess 1 number is greater than 6 digits -- please keep your guess within 6 digits total.";
  }
    if(!empty(
$_POST['guess2'])) {
$rules[] = "digits_only,guess2, Please only enter numbers with no commas.";
$rules[] = "length=6-7,guess2, No less or more than 6 numbers -- Guess 2 is greater than 6 digits-- please keep your guess within 6 digits total.";
    }
      if(!empty(
$_POST['guess3'])) {
$rules[] = "digits_only,guess3, Please only enter numbers with no commas.";
$rules[] = "length=6-7,guess3, No less or more than 6 numbers -- Guess 3 is greater than 6 digits-- please keep your guess within 6 digits total.";
      }
  
$errors validate_fields($_POST$rules);
 
  
// no errors - great! Now we process the page. The ft_api_process_form does
  // the job of both updating the database and redirecting to the next page
  
if (empty($errors))
{
$params = array(
  
"submit_button" => "sendguess",
  
"next_page" => "thanks.php",
  
"form_data" => $_POST,
  
"finalize" => true
    
);
ft_api_process_form($params);
}
  
// it failed validation. Update $fields with the latest contents of the form data
  
else 
  {
    
$fields array_merge($_SESSION["form_tools_form"], $_POST);
  }
}
?>


Reply
#8
Wow, you're on a roll! As I was reading your replies i was thinking to myself how I would respond to each of them, until I saw your next reply, where you fixed it...lol. I wouldn't have used the if statements quite like that in the validation, but if they work, then don't change them! Ha!

What I guess I wasn't understanding from your OP is that the form you were testing was not actually on a live server. I had that problem once before while running XXAMP. (XAMPP?). But I digress. As you've discovered, FT will not correctly process things unless it's on a live server. I'm sure with some tweaking, you could get it to, but that's WAY outside my area of expertise.

I'm happy that you got everything working Smile
PS - I have a medium expertise with the PHP validation, if you get stuck again. I've had my share of issues with it, as well. The only thing I CAN'T do (yet), is custom expressions. That's completely gibberish to me.
Not a FT employee, just a FT user lending a hand. If I've been helpful, please rate.

[Image: giraffe_long_85.gif]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)