For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > October 2005 > Re: [PEAR] [Quickform] isSubmitted() returns TRUE when it should not









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 Re: [PEAR] [Quickform] isSubmitted() returns TRUE when it should not
Damien Cros

2005-10-26, 6:57 pm

Mark Steudel

2005-10-26, 6:57 pm

I'm not a 100% clear about what you are trying to do, but if it sounds like
you have

Form 1 -> gets submitted -> display Form 2 ( which is a QuickForm )


If I were trying it I'd try:
<?php

require 'HTML/QuickForm.php';

funtction getRequest()
{
if ( isset( $_GET[thing] ) )
{
$request = $_GET[thing];
}
else if ( isset( $_POST[thing] ) )
{
$request = $_POST[request];
}
else
{
$request = NULL;
}
return $request;
}

if(!isset($request))
{
echo "
<html>
<body>
<form action=\"testsubmit.php\" name=\"form\"
method=\"post\"> <input name=\"thing\" type=\"hidden\"
value=\"something\"/> <input name=\"btnSubmit\"
type=\"submit\" value=\"go\" /> </form> </body> </html>";

}
else
{

$form = new HTML_QuickForm('formname');
$form->addElement('hidden', 'thing', getRequest() );
. add some more elements
. add some more elements
. add some more elements

if( $form->validate() )
{
process data
}
else
{
// if you are using smarty, replace $form->display() with
your smaty assignments
// e.g. $tpl->assign('content', $form->toHtml); or
something.
$form->display();
}

}


?>

Don't know if that's what you were trying to do or not ...

>-----Original Message-----
>From: Damien Cros [mailto:damienc@cc.in2p3.fr]
>Sent: Wednesday, October 26, 2005 8:37 AM
>To: PEAR general list
>Subject: Re: [PEAR] [Quickform] isSubmitted() returns TRUE
>when it should not
>
>Here's an example with SmartyStatic_example.php :
>The file is called "testsubmit.php".
>
><?php
>
>
>if(!isset($_REQUEST['thing']))
>{
>echo "
><html>
><body>
><form action=\"testsubmit.php\" name=\"form\"
>method=\"post\"> <input name=\"thing\" type=\"hidden\"
>value=\"something\"/> <input name=\"btnSubmit\"
>type=\"submit\" value=\"go\" /> </form> </body> </html>";
>
>}
>else
>{
> require_once('SmartyStatic_example.php');
>}
>
>
>?>
>
>

Sponsored Links







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

Copyright 2008 codecomments.com