For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2005 > TrackSubmit question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author TrackSubmit question
Lionel Worman

2005-05-27, 4:00 pm

I'm having some trouble working with the $trackSubmit option of
HTML_Quickform. The documentation mentions the following about it:

"boolean $trackSubmit

(optional) Whether to track if the form was submitted by adding a
special hidden field. If the name of such field is not present in the $_GET
or $_POST values, the form will be considered as not submitted. "

1st Question: is meant by adding a special hidden field, and how do I take
advantage of it?

2nd Question: I've set up the following page so that it requires something
be typed into the Text field entered_text. If the form is valid it should
post to the next page (form2.php). The problem is that as long as I have it
POST or GET to another page, it skips the validation. It skips the
validation no matter what I put in for tracksubmit.

form1.php -----------------
<?php

// start a session
session_start();

// Load the QuickForm code
require "HTML/QuickForm.php";

$form1 = new HTML_QuickForm("form1","POST", "form2.php", null, null, true);

$form1->addElement("text","entered_text","Enter some text");
$form1->addRule("entered_text","You must enter text","required");
$form1->addElement("submit","submit","Submit");

$valid = $form1->validate();
If ($valid) {
print "entered_text = ". $_POST["entered_text"];
$_SESSION["entered_text"] = $_POST["entered_text"];
}
$form1->display();

?>

form2.php --------
<?php

// start a session
session_start();

// Load the QuickForm code
require "HTML/QuickForm.php";

$form2 = new HTML_QuickForm("form2");

$form2->addElement("static",null,"You Entered :".$_SESSION["entered_text"]);

$valid = $form2->validate();
If ($valid) {
}
$form2->display();

?>

Any ideas on this would be greatly appreciated.
LMW
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com