34 users online (1 members and 33 guests)  


  Results 1 to 2 of 2

Related

  1. Javascript array in PHP    Forum: PHP Forum
    Replies: 0
  2. 'Searching' an array    Forum: PHP Forum
    Replies: 8
  3. Replies: 4
  1. #1
    jwzumwalt's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2007
    Posts
    6

    re-arrange array

    I have a working cgi script to create an e-mail. The code below sorts all the html $field & $value pairs. This is fine except I would prefer the "message/value" to be the last thing in the e-mail.

    So how do I find "message" and move it to the last array item?

    # bundle up form submissions into a mail_body

    $mail_body = '';

    foreach $field (sort ($query->param)) {
    foreach $value ($query->param($field)) {
    $mail_body .= "$field: $value\n";
    }
    }

    Thanks JZ

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: re-arrange array

    Not sure what you mean... How do I find message? Theres nothing in your code that relates to "message". But to move to last array item surely you could just use

    @array = push($message);



Tags for this Thread