Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    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
    Last edited by chump2877; 02-13-2006 at 03:20 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    New Coder
    Join Date
    Feb 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #4
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try replacing
    Code:
    global $oldtask; 
       global $newname;
    with
    PHP Code:
    $oldtask $_POST['oldtask'];
    $newname $_POST['newname']; 

  • #5
    New Coder
    Join Date
    Feb 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    forgot to say that i alredy solve the problem with other option..
    thank you for the help!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •