getting Vars to pass to next page.


Posted on 16th Feb 2014 07:03 pm by admin

Hello all,
I have a confusing situation on my hands, i am a member of a gaming community and we are setting up a website (yay i get to be teh techie!!) im not exactly a noob with php but i am by far not an expert, so i need some help please.

I have a table populated with mysql data, and i am using multiple submit buttons to perform actions to the selected row of information. i have 2 of the 3 buttons working great however the third is not passing on all the information that i need to pass to the next page. the only thing that is not passing is the var $name that is returned from mysql.

Below are the codes i am using. any help with how to get the var $name to pass with the $_POST information would be great, thanks in advance!

The Table:
Code: (php) <?php
include 'config.php';
include 'access.php';

$db = mysql_connect ($hostname, $username, $password) or die ('Failed to connect to database: ' . mysql_error());
mysql_select_db($database);

$query = "SELECT clan_members.authid, clan_members.rank, clan_members.name, admins.access FROM imagest5_bioclan.clan_members LEFT OUTER JOIN imagest5_bioclan.admins ON clan_members.name = admins.name WHERE clan_members.rank = 9 ORDER BY clan_members.rank DESC, clan_members.name";
$result = mysql_query($query) or die ('Failed to query ' . mysql_error());
?>
<form method="post" action="./process.php">
<table width="100%" border="1">
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">SteamID</th>
<th scope="col">Name</th>
<th scope="col">Rank</th>
<th scope="col">Flags</th>
</tr>
<?php
while ($row = mysql_fetch_assoc($result))
{
$auth = $row['authid'];
$name = $row['name'];
$rank = $ranks[$row['rank']];
$flags = $row['access'];
?>
<tr>
<td><div align="center">
<input type="radio" name="auth" id="radio" value="<?php echo "$auth";?>">
</div></td>
<td><?php echo "$auth";?></td>
<td><?php echo "$name";?></td>
<td><?php echo "$rank";?></td>
<td><?php echo "$flags";?></td>
</tr>
<?php
}
?>
</table>
<table width="100%">
<tr>
<td width="11%"><div align="center">
<input type="submit" name="submit[edit]" value="Edit">
</div></td>
<td width="20%"><div align="center">
<input type="submit" name="submit[delete]" value="Delete">
</div></td>
<td width="69%"><div align="center">
<select name="access" id="access">
<option selected="selected">Quick Admin----</option>
<option value='abcdefghijklmnopqrstu'>Leader/CoLeader</option>
<option value='abcdefghijklmnopqrstu'>Tech</option>
<option value='bcdefijmnopqrstu'>Upper Admin</option>
<option value='bcefijnprstu'>Mid Admin</option>
<option value='cfu'>Recruit Admin</option>
<option value='u'>Member</option>
</select>
<input type="submit" name="submit[access]" value="Set">
</div></td>
</tr>
</table>
</form>
<?php
mysql_free_result($result);
mysql_close($db);
?>

The table posts to this page:
Code: (php) <?php
//print_r($_POST);
$submit_array = array_keys($_POST['submit']);
$action = $submit_array[0];
if ($_POST)
{
switch ($action)
{
case 'edit':
echo include('./includes/edit.inc');
break;

case 'delete':
echo include('./includes/delete.inc');
break;
case 'access':
echo include('./includes/mem2admin1.inc');
break;
}
}
?>

and if the set button on the table is clicked the above page loads this:
Code: (php) <?php
if(!isset($_SESSION['clan_id']))
{
die("You are not logged in and cannot view this page.");
}
echo '<center>';
$auth = $_POST['auth'];
$name = $_POST['name'];
$access = $_POST['access'];
echo "

Are you sure you want to give '$access' flags to:

";
echo "SteamID: $auth<br />Name: $name";
echo "

<a href="admin_add3.php?auth=$auth&name=$name&access=$access">Yes</a>&nbsp;&nbsp;<a href="main.php">No</a></center>;"
?>

No comments posted yet

Your Answer:

Login to answer
203 Like 17 Dislike
Previous forums Next forums
Other forums

Page Reload
I am having issues getting a page to reload after I submit data to a database. This form should inp

Help with looping
I have a comma separated list of colors taken from a database ($ICo) and a directory of images named

Writing Windows Device Drivers with C
Yes: one of the nice features of C is void*. You can put anything there and get anything out. Very

Remore client postprocessing phase getting dump SAPSQL_ARRAY_INSERT_DUPREC
Hello Expects,I have started remore client copy. Data was copied successfully. but while running pos

My query is being run with no results.
I have this.

Code: function DropUser($duser_id, $user_email, $user_username) {

Weird MySQL error, why am I recieving this?
PHP Code:


<?php require "global_settings.php"; ?>
<titl

Automatically Detect Phone Model for WAP Jar Deployment
Making a wap site is fairly simple, but I'd like to know if there's a way to make it so that the wap

Transport data between itab and textfield on ALV event
Hallo,

I have a ALV Grid ( cl_gui_alv_grid ) and I also have hotspot click event with a h

How to show the difference between two data field in a database with php.
Hello php gurus,

how r u all... i'm not so well facing a typical problem please help me...<

Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a ne

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash