How transmit variable: $_POST['mat_guid'] to all paging pages in DataGrid?

From: Date: Wed, 02 Dec 2009 12:34:56 +0000
Subject: How transmit variable: $_POST['mat_guid'] to all paging pages in DataGrid?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30180@lists.php.net to get a copy of this message
Into page (con_materials_add.php) from another page (form) transmited variable: $mat_guid = $_POST['mat_guid']; On that page I use DataGrid with paging. Pages links have appearance: con_materials_add.php?page=2 con_materials_add.php?page=3 ... How I can transmit (or use in datagrid) this variable: $mat_guid = $_POST['mat_guid']; to all paging pages: con_materials_add.php?page=2 con_materials_add.php?page=3 con_materials_add.php?page=4 ... con_materials_add.php: <?php require 'Structures/DataGrid.php'; require_once 'server.php'; ?> <h1>Materials</h1> <?php $mat_guid = $_POST['mat_guid']; // Instantiate the DataGrid $datagrid =& new Structures_DataGrid(5); $datagrid->setDefaultSort(array('mat_mark' => 'ASC')); // Setup your database connection require_once '../inc/server_mdb2.php'; $options['dsn'] = $dsn; $options['generate_columns'] = true; $options['fields'] = array ('mat_guid','mat_mark'); $options['labels'] = array ( 'mat_guid' => 'ID', 'mat_mark' => 'MARK', ); $test = $datagrid->bind("SELECT mat_guid,mat_mark,mat_name,mat_description,mat_time,mat_priority FROM materials WHERE (mat_guid<>'$mat_guid')" , $options); $datagrid->addColumn(new Structures_DataGrid_Column('Chose', 'after', null, null, null, 'print_chekbox()')); $datagrid->addColumn(new Structures_DataGrid_Column('View', 'after', null, null, null, 'print_view_form()')); // Print binding error if any if (PEAR::isError($test)) { echo $test->getMessage(); } function print_chekbox($params) { extract($params); return('<input type="checkbox" name="connect[]" value="'.$record['mat_guid'].'">'.$record['mat_guid'].'<br />'); } function print_view_form($params) { extract($params); return '<form name="materials" method="post" action="materials_read.php" onsubmit="HTML_AJAX.formSubmit(this,\'target\');return false;"><input name="mat_guid" type="hidden" value='.$record['mat_guid'].'><input type="submit" value="View"> </form>'; } ?> <form name="con_materials_add" method="post" action=""> <?php // Print the DataGrid with the default renderer (HTML Table) $test = $datagrid->render(); // Print rendering error if any if (PEAR::isError($test)) { echo $test->getMessage(); } print('<center>'); // Print the HTML paging links $test = $datagrid->render(DATAGRID_RENDER_PAGER); if (PEAR::isError($test)) { echo $test->getMessage(); } ?> <br /> <input name="mat_guid" type="text" size="5" maxlength="100" value="<?php print($mat_guid); ?>" /> <INPUT type="submit" value="Connect" > </form> <?php $connect = $_REQUEST['connect']; if ((strlen($connect)!=0)and(strlen($mat_guid)!=0)) { include("../authorization/111.php"); foreach ($connect as $con) { $query_con = "INSERT INTO mat_connect SET mat_guid = '$mat_guid',con_guid = '$con'"; mysql_query($query_con) or die(mysql_error()); } mysql_close(); } print('</center><br />'); ?> <script type="text/javascript" src="server.php?client=all"></script> <div id="target"></div> <script type="text/javascript"> HTML_AJAX.replace('target','materials_read.php'); </script> <?php include('../inc/footer.php'); ?>

« previous php.pear.general (#30180) next »