Jump to content

Passing Value from one script to another script


pravonline

Recommended Posts

Dear All,

I,m trying to pass some values from one program to another program ( i.e. PGMA to PGMB ), But the vaues are not coming in the PGMB, Can anyone suggest me what went wrong in the PGMA, Plase find the sample code for PGMA and PGMB.
[code]
<html>
<head>
<title>User Choices</title>
</head>
<body>

<?php
require_once 'DB.php'; // must be included in any script that uses PEAR::DB

$db_host    = "localhost";    // hostname of the database server
$db_user    = "root";           // database user's username
$db_pass    = "";        // database user's password, nothing by default
$db_name    = $_POST['dbname'];    // the name of the database to connect to
$db_type    = "mysql";          // the type of database server.
$tb_name    = $_POST['tbname'];    // the name of the database to connect to
//$tabelle    = $_POST['tbname'];
//$tabelle = $company_prefix.'tbname';      
// your data source name string. This contains the connection
// information for your database.
$dsn = "$db_type://$db_user:$db_pass@$db_host/$db_name";
// creates a database connection object or a database error
// object based on the success of the database connection.
$db = DB::connect($dsn, TRUE);


// if an error was encountered, the script exits with an error message
if (DB::isError($db)) {
    die($db->getMessage());
}
?>

<fieldset>
<font color="red"><b>           Field          
      Type </b>
</fieldset>

<font color="blue">
<form name="fmTime" id="select_period" " action="disp.php" method="post">

<?php
// SQL query that you wish to use to query the database
$sql = "show fields from $tb_name";
$result = MYSQL_QUERY($sql);
//$val = 0;
$cnt=0;
while($row=mysql_fetch_row($result))
{
$dbnames1[]=$row[0];
$dbnames2[]=$row[1];
//$val=$val+1;
//*foreach ($row as $col=>$val)
//foreach ($dbnames as $col=>$val)
//*{

?>
<td>


</td>

<?php
//PRINT $val;
     PRINT $dbnames1[$cnt];
     ?>
  <spacing>                
   <spacing>
     <?php
    
  
     PRINT $dbnames2[$cnt];
    
       ?>
  <spacing>                
   <spacing>
     <?php
     $field=0;
  $_post['field']=$dbnames1[$cnt];
     if (strpos($dbnames2[$cnt], 'varchar') !== false) {

?>
  
    <SELECT NAME="parm[]" >
<OPTION>=
<OPTION>LIKE
<OPTION> NOT LIKE
</SELECT>
<spacing>            
<spacing>
<input type="text" name="name1" /> <P>


<?php  
}
else
{
?>

<SELECT NAME="parm[]">
<OPTION>=
<OPTION>LIKE
<OPTION> !=
</SELECT>
<spacing>            
<spacing>
<input type="text" name="name1" value="suresh" /> <P>
<?php
}
//*}
$cnt=$cnt+1;
}
?>


<p><input type="submit" /></p>


</form>
</body>
</html>
[/code]

And PGMB is as follows:

[code]
<?php
print 'test';
$val1 = $_post['field'];
print $_post['parm'];
print $_post['parm[1]'];
print $_post['parm[2]'];
print $val1;
print $_post['name1'];
?>
[/code]

In PGMB, I'm trying to print the fileds like "field", "parm", "parm[1]", "parm[2]" and "name1" which should have the values from the PGMA, But surprisingly, no values are printing execpt "test", Can someone suggest me what needs to be corrected?
Thanks and Regards,
Praveen

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.