PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website

    how to fill $form->value


    Number of posts : 42
    Registration date : 2009-02-19

    how to fill $form->value

    Post  mbrad on Fri Apr 23, 2010 1:05 pm

    Thanks for taking the time to read my question.

    I have a form that I want to use to edit data that is in my DB. I'm using $form->value in the value="" part of my <input />.

    I have a query that returns the data that should go into the form, but the value="" field is alrealy taken by $form->value. So I was thinking that if I could fill the $form->value array, I could get my data into the form to edit the data. I just can't figure out how to do that.

    Any help would be great.



    <input class="inputalign" id="ss<?php echo $x; ?>" name="ss<?php echo $x; ?>" value="<?php echo $form->value('ss'.$x); ?>" />

    So when the form loads $form->value() does not equal anything, but I do want to put data in that field, data that the user would like to edit.

    Below was Added Later

    Kept fooling around with it...

    I've tried:


    $retval is the result of
    where $q is my sql string.

    didn't work, nothing shows up in my form... which works when I enter bad data. The data shows up in my form for the user to edit.

    Below was Added Even Later

    What is the form.php expecting for an array? I made up an array and assigned it to $_SESSION['value_array'], with and without the key in the array. If I put the proper field name in as the key to the value I get stuck on


    function value($field){}

    The error shows up on my form instead of the data...

    Ok, more findings

    I have this code:

    //$_SESSION['value_array'] = array('scHT1'=>'Capitols', 'scHTG1'=>'34', 'scAT1'=>'Ice Cats', 'scATG1'=>'44', 'scGD1'=>'2010-04-11', 'scGT1'=>'13:15:00', 'scHT2'=>'Manitoba Maple Leafs', 'scHTG2'=>'99', 'scAT2'=>'Ice Cats', 'scATG2'=>'98', 'scGD2'=>'2010-04-02', 'scGT2'=>'13:15:00');
          while ($row = mysql_fetch_assoc($retval)) {
             foreach($row as $value){
                if(!isset($arraystring)) {
                   $arraystring = "'" . $fieldnames[$y] . $x . "'" .  "=>" . "'" . $value . "'";
                   //echo $fieldnames[$y] . $x . " " . $value ."<br />";
                else {
                   $arraystring = $arraystring . ", '" . $fieldnames[$y] . $x . "'" .  "=>" . "'" . $value . "'";
          $arraystring = "array(" . $arraystring . ")";
          //echo $arraystring;
          $_SESSION['value_array'] = $arraystring;
          header("Location: ".$session->referrer);

    If I run it this way I get an error. If I reverse the comment out and make everything that is commented out, active and vice versa, it works. Now it's static, not dynamic, so it's not quite what I need. The array that $_SESSION['value_array'] is being set to is the echo $arraystring;

    Why does it not work when I make $_SESSION['value_array'] = $arraystring; ???



    Number of posts : 9
    Registration date : 2010-03-22

    Re: how to fill $form->value

    Post  Apollo on Mon May 10, 2010 10:07 pm

    I just read the first part of your topic, cuz theres an easier way to do it than that. Just do a query to the DB for that particular record you are trying to access rather than using session variables. Then once you have the data from the query just use variable in the value fields in your form.

    Hope this helps.

      Current date/time is Sat Feb 16, 2019 10:22 pm