...

View Full Version : problems with checkbox



katherine06
02-13-2006, 02:54 AM
hello to all!!
I have a code which edits a USER's record..
when this checkbox is selected, and when EDIT button is click, it will go to confirm.php which checks what checkbox has been selected, then it will redirect to edit.php..
edit.php is for editing the selected record. It should display the USER's Name so that the administrator will know who's user he will edit..
The problem is, I cannot display the USER's Name ..
I'm not sure if i pass the values to the EDIT File correctly for editing..


if(isset('edit user'))
{
if (isset($_POST['cb']))
{
foreach ($_POST['cb'] as $key => $value)
{
echo"<input type='hidden' name='taskvalue' value='$value'>";
redirect('edit');
};
}
else
{
msgbox("You have not clicked any checkboxes!!!");
redirect('index);
}
}


Also, IS IT POSSIBLE TO PASS THE VALUE OF THE CHECKBOX TO ANOTHER FILE, THEN TO ANOTHER FILE?????

(I have a lot of buttons that directs to confirm.php that is why i use only one form..)
Somebody help please please please!!..

thank u all in advance and God Bless!!:o

chump2877
02-13-2006, 03:08 AM
It sounds like you want to use SESSION variables to pass data across multiple files: http://us2.php.net/manual/en/ref.session.php

Here's another link for you, maybe easier to understand: http://codewalkers.com/tutorials/32/1.html

katherine06
02-13-2006, 03:40 AM
thanks for the concern..;)
ahm..yes i am using SESSION...i am new with php..i don't understand the link u provided me,. it says a lot :( ..
what does it have to do with sessions? does sessions affect that is why i can't pass the value ???
by the way my code for edit.php is like this..


<?
global $taskvalue;
echo$taskvalue;
?>
<br>
<form method=post action='confirm.php'>
New Task Name:<input type=text name='newname'><br>
<input type=submit name='save'>
<input type=hidden name='oldtask' value='$taskvalue'></form>

and for confirm.php is like this


if(isset($save))
{
global $oldtask;
global $newname;
$query="update task set task_name='$newname' where task_name='$oldtask';";
mysql_query($query);
msgbox("Record saved!!!");
redirect('index');
}


i made it simple first, i want to check first if the value i will be editing is the value i selected in the index.php..help please :o ..thankzz:)

degsy
02-13-2006, 03:41 PM
Try replacing


global $oldtask;
global $newname;


with


$oldtask = $_POST['oldtask'];
$newname = $_POST['newname'];

katherine06
02-14-2006, 09:44 AM
forgot to say that i alredy solve the problem with other option..
thank you for the help!!! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum