doucie Posted April 14, 2007 Share Posted April 14, 2007 Hi All, I've got the following function to get data and display in a selection list and then post to the receiving page but it does not seem to work. Please help. <?php function get_groups() { $db=mysqli_connect('localhost','root','','debtnet'); if(mysqli_connect_errno()) { echo 'Could not connect to the database'; exit; } $query="SELECT cclientgroup FROM groups ORDER BY cclientgroup"; $result=mysqli_query($db,$query); ?> <form action="group_report.php" method="POST" /> <select name="Client" id="Client" /> <?php while($list=mysqli_fetch_array($result)){ echo "<option value='".$list['cclientgroup']."'>".$list['cclientgroup']."</option>"; } echo "<input type='submit' value='Get Report'/>"; echo "</form>"; } ?> The code for the receiving page is this: <?php $client = $_POST['cclientgroup']; ?> <div id="box"> Information relating to client group: <?php echo $_POST['cclientgroup']; ?> </div> Link to comment https://forums.phpfreaks.com/topic/47042-solved-form-data-not-being-posted-to-receiving-page/ Share on other sites More sharing options...
freakstyle Posted April 14, 2007 Share Posted April 14, 2007 Hey Doucie, this should do the trick for you: <div id="box"> Information relating to client group: <?php echo $_POST['Client']; ?> </div> 'you just needed to insert the name of the field you passed to the next page (instead of the actual value, the value is what is echo'd out above) enjoy Link to comment https://forums.phpfreaks.com/topic/47042-solved-form-data-not-being-posted-to-receiving-page/#findComment-229406 Share on other sites More sharing options...
doucie Posted April 14, 2007 Author Share Posted April 14, 2007 Nice one. Cheers Link to comment https://forums.phpfreaks.com/topic/47042-solved-form-data-not-being-posted-to-receiving-page/#findComment-229415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.