Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-13-2006, 02:54 AM   PM User | #1
katherine06
New Coder

 
Join Date: Feb 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
katherine06 is an unknown quantity at this point
Question problems with checkbox

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..
PHP Code:
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!!

Last edited by katherine06; 02-13-2006 at 03:01 AM..
katherine06 is offline   Reply With Quote
Old 02-13-2006, 03:08 AM   PM User | #2
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
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
__________________
Regards, R.J.

Last edited by chump2877; 02-13-2006 at 03:20 AM..
chump2877 is offline   Reply With Quote
Old 02-13-2006, 03:40 AM   PM User | #3
katherine06
New Coder

 
Join Date: Feb 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
katherine06 is an unknown quantity at this point
Question

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..
PHP Code:
<?
   
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
PHP Code:
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 ..thankzz

Last edited by katherine06; 02-13-2006 at 03:43 AM..
katherine06 is offline   Reply With Quote
Old 02-13-2006, 03:41 PM   PM User | #4
degsy
Senior Coder

 
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
degsy is on a distinguished road
Try replacing
Code:
global $oldtask; 
   global $newname;
with
PHP Code:
$oldtask $_POST['oldtask'];
$newname $_POST['newname']; 
degsy is offline   Reply With Quote
Old 02-14-2006, 09:44 AM   PM User | #5
katherine06
New Coder

 
Join Date: Feb 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
katherine06 is an unknown quantity at this point
forgot to say that i alredy solve the problem with other option..
thank you for the help!!!
katherine06 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:13 PM.


Advertisement
Log in to turn off these ads.