[PHP-users 27241] redirect on successful submisssion to another page in Quickform

sundara@cba.att.ne.jp sundara @ cba.att.ne.jp
2005年 10月 17日 (月) 15:54:53 JST


Dear Sir/Madam

I have a simple problem while using require_once functionality.

Page1.php is using as an input form , and after input, the control will
be transfered to pgae2.php with the same Workspace env as page1.php.
Page2.php will be displayed as per my requirement, however after the page2.form,
again the page1.php will be displayed in the tail of page2.php .

All form variable of page1.php are accessible in the page2.php. 
However the control is not transfered as expected.
(I do not want to use SELF .. Posting)

image of the problem (tested and you can re-produce the errors);

Php 5.04/Apache 2, windows 2003


--page1.php--

<?php
/*
PROBLEM: After using the Require_once 'page2.php' it still re-displays the page1.php at the end of the Displayed page2.php form

image of the problem
------------------------------page1.php-------------------------
*/
require_once('HTML/QuickForm.php');
$obj_search_form = new HTML_QuickForm('frmSearch','POST');
$obj_search_form->addElement('text','txtCode','CODE:',array('size' =>10,'maxlength' =>10));

$obj_submit[] = &HTML_QuickForm::createElement('submit', 'btnSubmit', 'GO');
$obj_search_form->addGroup($obj_submit, '', '', '&nbsp;&nbsp;');
if($obj_search_form->validate()) {
	
	// post-validation filters comes here
	$obj_search_form->applyFilter('__ALL__', 'addslashes');
	
	//  "search_mserver_logdata" function to search 
	$obj_search_form->process('search_mserver_logdata', false);
    //require_once('page2.php.php');
    // the above direction does not pass varibles to pag2.php
	
}
function search_mserver_logdata($ary_sloginput_info) {
$tcode=$ary_sloginput_info['txtCode'];

echo "before calling: $tcode         ";
echo " ";
require_once('page2.php');
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS Pragma: no-cache">
 <TITLE>Serverlogcheck</TITLE>
</HEAD>
<BODY>	
<?php

	// display the form here
	$obj_search_form->display();

?>
</BODY>
</HTML>

-----page1.php ends here-----------------

------------------Page2.php----------

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS Pragma: no-cache">
 <TITLE>Serverlogcheck</TITLE>
</HEAD>
<BODY>	
<?php

	// display the data here
	$tActcode=$ary_sloginput_info['txtCode'];
        echo "<P>";
        echo var_dump($ary_sloginput_info);
        echo "<P>";
	echo " inside the page2.php: $tActcode";
?>
<p>c 2005 baka. All rights reserved.</p>
</BODY>
</HTML>

----------------------page2.php ends here---

Thanks in Advance

sundara



PHP-users メーリングリストの案内