tags:

views:

43

answers:

2

hi all..

Consider 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!!

A: 
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
mathroc
ooops..above code doesn't works:(
ish12
hi mathroc..ur code partially works i mean in o.php both html and php code is there so need to run whole program but code executes only php part it doesnot get input from user using html which i have written code in the same o.php.pl assist me..
ish12
helping you will be hard without more details, can you show us what is in o.php and t.php, what is the result and what should be the result.
mathroc
A: 
<?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
Tarek Fadel