Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: How to use foreach to display data from multiple column?

  1. #11
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    1.
    <font face="Arial">------------------------------------------------------------------------------------------------------------------------------ <br>
    a. get rid of the font tag <font> it has been depreciated.
    b. you can use the horizontal rule tag and kill 2 birds with 1 stone.
    HTML Code:
    <hr>
    2.
    Thanks for reply.Now the entire thing,including the dashed line is on center,how can keep it on left?
    if the table is 100% there shouldn't be any center but you can use css styling to accomplish this, and force everything to the left
    HTML Code:
    <style type="text/css">
    table, table * {
         margin: 0;
         padding: 0;
         text-align: left;
    }
    </style>

  2. #12
    Join Date
    Aug 2007
    Location
    Malaysia
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for helping,by now I would like to submit the form after clicking one of the radio button.How can the selected screeningTime and its movie name being captured by $_POST?Really appreciate for your initiative.

    PHP Code:
    <?
    if (isset($_SESSION['gmemberid'])) {
        
    $tbl_name "movie";

        
    $result mysql_query(sprintf('SELECT name,category,screeningTime FROM %s
                 LIMIT 7'
    $tbl_name)) or die('Cannot execute query.');

        
    //$numrow = mysql_num_rows($result);


        
    while ($rows mysql_fetch_assoc($result)) {
            echo 
    '<table width="100%" border="0"><tr><td height="68">
                      <table width="100%" height="47" border="0">
                       ---------------------------------------------------------------------------------------------------------<br>'
    ;

            echo 
    '<strong>' $rows['name'] . ' (' $rows['category'] . ')
                     <br></strong>'
    ;
            foreach (
    explode(','$rows['screeningTime']) as $time) { ?>
                <label>
                <input type="radio" value="<?php echo $time?>">
                <?php echo $time?>&nbsp;&nbsp;&nbsp;
                </label>
                <?php ?>
    <?
        
    }


    }
    ?>

  3. #13
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    process.php
    PHP Code:
    $_POST['movie'];
    $_POST['time']; 
    file.html
    HTML Code:
    <form name="something" action="process.php" method="post">
      <label>Movie</lable>
       300<input type="radio" name="movie" value="300">
       We Were Soldiers<input type="radio" name="movie" value="We were Soldiers">
       Titanic<input type="radio" name="movie" value="Titanic">
    ...
      <label>Time</lable>
       11:00am<input type="radio" name="time" value="1100">
       7:10pm<input type="radio" name="time" value="1910">
       9:15pm<input type="radio" name="time" value="2115">
    ...
    </form>
    but I thought you were grabbing your information from the database?

  4. #14
    Join Date
    Aug 2007
    Location
    Malaysia
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ya.What I have done is to grab movie list from database.But now user need to register movie ticket so the selected screeningTime and its movie title need to be captured and stored to database later.

  5. #15
    Join Date
    Aug 2007
    Location
    Malaysia
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Did anybody know how to capture it?Thanks for your generious help...

Bookmarks

Posting Permissions

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