Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Posts posted by phpretard

  1. Here is all of the code...

     

    
    if(isset($_POST['order_photo'])) { 
    
    $file = array();
    
    $file[0] = $_POST['S46'];
    $file[1] = $_POST['QU46'];
    $file[2] = $_POST['S57'];
    $file[3] = $_POST['QU57'];
    $file[4] = $_POST['S810'];
    $file[5] = $_POST['QU810'];
    $file[6] = $_POST['file'];
    $file[7] = $_POST['picture'];
    
    
    
    foreach($file as $val){
    
        $_SESSION[$val] = $val;
    }
    }
    

     

    Does this make a difference?

  2. This is the array:

    Array ( [4 x 6] => 4 x 6 [] => [5 x 7] => 5 x 7 [8 x 10] => 8 x 10 [P1040050.jpg] => P1040050.jpg [ALBUMS/Holmes_Adams/P1040050.jpg] => ALBUMS/Holmes_Adams/P1040050.jpg ) 
    

     

    Here is the form:

    <form action=' ' method=post>
    
    <input type=hidden name=picture value='$picture'>
    <input type=hidden name=file value='$file'>
    
    <input type=checkbox name=S46 value='4 x 6'> 4 x 6
    
    Quantity:<br>
    <input type=text name=QU46  size=4>
    
    <input type=checkbox name=S57 value='5 x 7'> 5 x 7
    
    Quantity:<br>
    <input type=text name=QU57 size=4>	
    
    <input type=checkbox name=S810 value='8 x 10'> 8 x 10	
    
    Quantity:<br>
    <input type=text name=QU810 size=4>
    
    <input type=submit name=order_photo value='Order This Photo'>

     

    </form>

  3. If I put letters in the input field it shows up.

     

    If I put numbers nothing show up.

     

    What am I missing?

     

    $file = array();
    
    $file[0] = $_POST['S46'];
    $file[1] = $_POST['QU46']; // numeric value
    $file[2] = $_POST['S57'];
    $file[3] = $_POST['QU57']; // numeric value
    $file[4] = $_POST['S810'];
    $file[5] = $_POST['QU810']; // numeric value
    $file[6] = $_POST['file'];
    $file[7] = $_POST['picture'];

  4. I have tried something similar and this is what I get.

     

    Parse error: syntax error, unexpected $end on line 48

     

    I get the same with the code you put up.

     

    
    if(isset($_POST['order_photo'])) { 
    
    $file = array();
    $file[] = $_POST['S46'];
    $file[] = $_POST['QU46'];
    $file[] = $_POST['S57'];
    $file[] = $_POST['QU57'];
    $file[] = $_POST['S810'];
    $file[] = $_POST['QU810'];
    $file[] = $_POST['file'];
    $file[] = $_POST['picture'];
    
    foreach($file as $val){
    
        $_SESSION["$val"] = $val;
    
    print_r($_SESSION['$val']);
    }
    

     

     

     

    Could you perhapse elaberate just a little?

  5. I have tried quite a few time and can't quite make it work.

     

    $file keeps showing up instead of "$files" 's posted value.

     

    Array ( [$file] => Array ( [0] => 4 x 6 [1] => 10 [2] => 5 x 7 [3] => 20 [4] => 8 x 10 [5] => 30) ) 
    

     

    if(isset($_POST['order_photo'])) { 
    
    
    $file = array();
    
    $file[0] = $_POST['S46'];
    $file[1] = $_POST['QU46'];
    $file[2] = $_POST['S57'];
    $file[3] = $_POST['QU57'];
    $file[4] = $_POST['S810'];
    $file[5] = $_POST['QU810'];
    $file[6] = $_POST['file'];
    $file[7] = $_POST['picture'];
    
    
    $_SESSION['$file']=$file;
    
    print_r($_SESSION); 
    
    }

     

    Actually...is $file even naming the Session Var?

  6. That worked well!

     

    Is there an easy way to put the array into a session var?

     

    if(isset($_POST['order_photo'])) { 
    
    
    $picture = array();
    
    $picture[0] = $_POST['S46'];
    $picture[1] = $_POST['QU46'];
    $picture[2] = $_POST['S57'];
    $picture[3] = $_POST['QU57'];
    $picture[4] = $_POST['S810'];
    $picture[5] = $_POST['QU810'];
    
    echo "<pre>";
    print_r($picture);
    echo "</pre>";
    
    }

  7. This just echos "Array".  WHY?

     

    
    if(isset($_POST['order_photo'])) { 
    
    $picture = array();
    
    $picture[0] = $_POST['S46'];
    $picture[1] = $_POST['QU46'];
    $picture[2] = $_POST['S57'];
    $picture[3] = $_POST['QU57'];
    $picture[4] = $_POST['S810'];
    $picture[5] = $_POST['QU810'];
    
    echo $picture;
    
    }
    
    

     

    Thank you!

  8. Sorry for being so ignorant...

     

    How can I put all this in one array?

     

    // POSTS
    
    $picture=$_POST['picture'];
    $S46=$_POST['S46'];
    $QU46=$_POST['QU46'];
    
    $S57=$_POST['S57'];
    $QU57=$_POST['QU57'];
    
    $S810=$_POST['S810'];
    $QU810=$_POST['QU810'];
    
    $file=$_POST['file'];
    
    //END POSTS
    
    // ARRAY STARTS HERE
    
    $_SESSION['S46']    =$S46;
    $_SESSION['QU46']   =$QU46;
    
    $_SESSION['S57']    =$S57;
    $_SESSION['QU57']   =$QU57;
    
    $_SESSION['S810']   =$S810;
    $_SESSION['QU810']  =$QU810;
    
    $_SESSION['picture']=$picture;
    $_SESSION['file']   =$file;
    $_SESSION['time']   =date('m-d-Y');
    
    //ARRAY ENDS HERE
    
    

     

    OK... Now all the info above is in an array (which Im not 100% on).

     

    How do I save that array and add a new one with different values.

     

    I'm am a little confused.

  9. Each form submission needs to create a new session variable and also hold on to the last one.

     

    form submitted:

     

    $_SESSION['picture']='1234';
    $_SESSION['size']    ='4x6';
    $_SESSION['quantity']  ='10';
    $_SESSION['file']=$file;
    $_SESSION['time']   = date('m-d-Y');

     

    In the same session another form is submitted by the same person:

     

    $_SESSION['picture']='5678';
    $_SESSION['size']    ='8x10';
    $_SESSION['quantity']  ='20';
    $_SESSION['file']=$file;
    $_SESSION['time']   = date('m-d-Y');

    This could happen many times.

     

    After someone is finished submitting all the forms...all the variables are emailed.

     

     

     

     

     

  10. I need to set these variable multiple time with different values.

     

    They are set via form submit. There are many forms and each form could have different values.

     

    Can anyone help me do this without have to write the code over and over and over...

     

    
    $_SESSION['picture']=$picture;
    $_SESSION['size']    =$size;
    $_SESSION['quantity']  =$quantity;
    $_SESSION['file']=$file;
    $_SESSION['time']   = date('m-d-Y');
    
    

     

    Thank you.

  11. I can't figure why this displays nothing but error.

     

    I am trying to count the number of files in a specified folder.

     

    
    $dirname = "ALBUMS/".$loc;
    
    function num_files($dirname) 
    { 
        return count(glob($dirname)); 
    } 
    echo num_files();
    
    

     

    Here is the error: Warning: Missing argument 1 for num_files(),

  12. Is there a simple way to:

     

    Create an array with the values:

     

    - quantity=50 | Pid=P9110 -

     

    I will need to insert this into a database field named "4x6" and be able to update the array on the fly.

     

    Almost done...

     

    I then need to count how many item are in the array (now located in the DB) and display the count.

     

    I don't need the insert code, I need to know how to make this array, count it and update it.

     

    
    <form>
    <input name=quantity>
    <input name=Pid>
    </form>
    

     

    I hope this makes sense.  Please tell me if clarification is needed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.