php-windows Digest 20 Aug 2003 02:04:07 -0000 Issue 1878

Topics (messages 21185 through 21190):

Thank you!
        21185 by: mforsell.newarkinone.com

Multiple selection in php
        21186 by: Harpreet
        21187 by: Charles P. Killmer
        21188 by: John Ellingsworth

output a table
        21189 by: Anthony Ritter
        21190 by: Svensson, B.A.T. (HKG)

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
See the attached file for details

--- End Message ---
--- Begin Message ---
I want to select multiple rows in a list box. I know PHP does not support
that.What other ways can I allow user to select multiple options other then
giving them check boxes for each option.

Help is appreciated.

Thanks


--- End Message ---
--- Begin Message ---
<select name="test[]" multiple size="5">
<option>
...
</select>

PHP will get an array of the selected values in a variable named $test

Charles Killmer

-----Original Message-----
From: Harpreet [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2003 4:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Multiple selection in php


I want to select multiple rows in a list box. I know PHP does not
support that.What other ways can I allow user to select multiple options
other then giving them check boxes for each option.

Help is appreciated.

Thanks


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
PHP can support it easily :)

On your form.php put:

// OPEN YOUR FORM
        echo "<FORM action=keyword.php method=POST name=addKeyword>\n";
//CREATE A SELECT BOX
        echo "<Select MULTIPLE SIZE=10 name=keyword[] class=css>\n";
// A BUNCH OF CHOICES
        echo "<option value=\"WORD\">WORD\n";
//CLOSE YOUR FORM
        echo "</form>\n";
//END FORM.PHP?


In your post.php page put:

// DO SOME ERROR CHECKING FOR SAFETY SAKE
// LOOP THROUGH THE FORM.PHP KEYWORD[] ARRAY 
        if(is_array($keyword))
                {
                        for($i=0; $i<count($keyword); $i++)
                        {
                                echo $keyword[$i];                      }
                }       
//END POST.PHP?

Thanks,

John Ellingsworth 
http://mail.med.upenn.edu/~jellings/




-----Original Message-----
From: Harpreet [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 19, 2003 5:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Multiple selection in php


I want to select multiple rows in a list box. I know PHP does not support
that.What other ways can I allow user to select multiple options other then
giving them check boxes for each option.

Help is appreciated.

Thanks


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hi...
I'm trying to output a table with alternate background color rows.

The following snippet outputs a table after connecting to a mySQL database
with posts but all of the rows have the same bgcolor.

Any help with the syntax will be greatly appreciated.
Thank you.
Tony Ritter
........................................
<?

<table width=100% cellpadding=3 cellspacing=1 border=1>
   <tr>
   <th bgcolor=\"#497fbf\"><font color=\"#ffffff\">AUTHOR</font>
   </th>
   <th bgcolor=\"#497fbf\"><font color=\"#ffffff\">POST</font></th>
   </tr>";

   while ($posts_info = mysql_fetch_array($get_posts_res)) {
       $post_id = $posts_info['post_id'];
       $post_text = nl2br(stripslashes($posts_info['post_text']));
       $post_create_time = $posts_info['fmt_post_create_time'];
       $post_owner = stripslashes($posts_info['post_owner']);

       $color1 = "#CCFFCC";
       $color2 = "#BFD8BC";
       $posts_info = 0;
       $row_color = ($posts_info % 2) ? $color1 : $color2;

       //add to display
       $display_block .= "
       <tr>
       <td width=35% valign=top
bgcolor=\"$row_color\"><p>$post_owner<br>[$post_create_time]</td>
       <td width=65% valign=top bgcolor=\"$row_color\"><p>$post_text<br><br>
       <a href=\"replytopost.php?post_id=$post_id\"><strong>REPLY TO
POST</strong></a></td>

       </tr>";

   }

  //close up the table
  $display_block .= "</table>";
?>




--- End Message ---
--- Begin Message ---
Nothing seams to be  wrong with the syntacs, but rather the semantics:

The statment "$posts_info = 0;" makes sure you will only print one color.
$posts_info should be read from the database along with the other values.

-----Original Message-----
From: Anthony Ritter
To: [EMAIL PROTECTED]
Sent: 2003-08-20 02:36
Subject: [PHP-WIN] output a table

Hi...
I'm trying to output a table with alternate background color rows.

The following snippet outputs a table after connecting to a mySQL
database
with posts but all of the rows have the same bgcolor.

Any help with the syntax will be greatly appreciated.
Thank you.
Tony Ritter
........................................
<?

<table width=100% cellpadding=3 cellspacing=1 border=1>
   <tr>
   <th bgcolor=\"#497fbf\"><font color=\"#ffffff\">AUTHOR</font>
   </th>
   <th bgcolor=\"#497fbf\"><font color=\"#ffffff\">POST</font></th>
   </tr>";

   while ($posts_info = mysql_fetch_array($get_posts_res)) {
       $post_id = $posts_info['post_id'];
       $post_text = nl2br(stripslashes($posts_info['post_text']));
       $post_create_time = $posts_info['fmt_post_create_time'];
       $post_owner = stripslashes($posts_info['post_owner']);

       $color1 = "#CCFFCC";
       $color2 = "#BFD8BC";
       $posts_info = 0;
       $row_color = ($posts_info % 2) ? $color1 : $color2;

       //add to display
       $display_block .= "
       <tr>
       <td width=35% valign=top
bgcolor=\"$row_color\"><p>$post_owner<br>[$post_create_time]</td>
       <td width=65% valign=top
bgcolor=\"$row_color\"><p>$post_text<br><br>
       <a href=\"replytopost.php?post_id=$post_id\"><strong>REPLY TO
POST</strong></a></td>

       </tr>";

   }

  //close up the table
  $display_block .= "</table>";
?>




-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---

Reply via email to