开发者

user input of one php script pass to another php without modification in first php script

Consi开发者_开发技巧der two php scripts(o.php & t.php) o.php contains both html and php. html here gets user input for eg:user name and password this information is passed to php using php-self.

I want the user input of o.php passed to t.php without any modification in o.php.

I ve used include and require in the t.php but the problem is it displays the output of o.php but i need only the user input values from o.php without displaying the output of o.php.

Using functions or session in o.php we can pass user input but am in the situation tat i should not add or modify o.php.

thanks in advance!!


ob_start(); // tells to store output in a buffer
require 'o.php'; // include o.php => o.php do his stuff with user data
ob_end_clean(); // tells to end buffering and clean buffer


<?php
// top of t.php

if (isset($_POST['submitButton'])){
    // grab data from $_POST
    // do stuff with the 
} else {
    include("o.php");
}
?>

This will output the input <form> from o.php, but the form will be submitted to t.php.

Assumptions made:

  1. The <form> method in o.php is POST
  2. The <form> action in o.php is <?php echo $_SERVER['PHPSELF']; ?> or equivilant
  3. The submit in o.php button name attribute is submitButton
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜