Jump to content

[SOLVED] A Stupid Question.


Lamez

Recommended Posts

I know this is a stupid question, but I had the ACT today and my brain is fried. I think this would be correct, but if it was, then I would not be posing this.

 

I have a for loop and I have multiple forms and I separate them with a horizontal rule, <hr />, anyways I do not want it on the last one, so I tossed in a if statement, well it did not work. I was wondering if you guys could take a look at it for me.

 

IF Statement:

if ($num == $counter){ print '<hr />'; }

 

Entire Code:

<?php
ob_start();
$path = "../../";
$title = "Create Football Bowls";
$rank = "yes";
$u_login = "yes";
$admin = "yes";
include ($path."main/include/cons/head.php");

$num = $_POST['bowl_num'];


for ($counter = 1; $counter <= $num; $counter++) {
?>
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0">
  <tr>
    <td width="6%"> Name: </td>
    <td width="36%"><label>
      <input name="b_name" type="text" id="b_name" />
    </label></td>
    <td width="6%">Bowl Img: </td>
    <td width="52%">IMGIMGIMG</td>
  </tr>
  <tr>
    <td>Date:</td>
    <td><label>
      <input name="b_date" type="text" id="b_date" />
    </label></td>
    <td>Time:</td>
    <td><label>
      <input name="b_time" type="text" id="b_time" />
    </label></td>
  </tr>
  <tr>
    <td>Place:</td>
    <td><label>
      <input name="b_place" type="text" id="b_place" />
    </label></td>
    <td>Network:</td>
    <td><label>
      <input name="b_net" type="text" id="b_net" />
    </label></td>
  </tr>
  <tr>
    <td>Team A:</td>
    <td><?php 
$q = mysql_query("SELECT * FROM `foot_teams` ORDER BY `team`");
  echo '<select name="ta-'.$counter.'" id="ta-'.$counter.'">';
    while ($r = mysql_fetch_array($q)){
    if($r['team'] == ($ta)){
      echo '<option value="'.$r['team'].'" selected>'.$r['team'].'</option>';   
    }else{
      echo '<option value="'.$r['team'].'">'.$r['team'].'</option>';
     }
    }
  echo '</select>'
?></td>
    <td>Record-A:</td>
    <td><input name="b_rec_a" type="text" id="b_rec_a" /></td>
  </tr>
  <tr>
    <td>Team B:</td>
    <td><?php 
$q = mysql_query("SELECT * FROM `foot_teams` ORDER BY `team`");
  echo '<select name="tb-'.$counter.'" id="tb-'.$counter.'">';
    while ($r = mysql_fetch_array($q)){
    if($r['team'] == ($tb)){
      echo '<option value="'.$r['team'].'" selected>'.$r['team'].'</option>';   
    }else{
      echo '<option value="'.$r['team'].'">'.$r['team'].'</option>';
     }
    }
  echo '</select>'
?></td>
    <td>Record-B:</td>
    <td><label>
      <input name="b_rec_b" type="text" id="b_rec_b" />
    </label></td>
  </tr>
  <tr>
    <td>Point Val: </td>
    <td><label>
      <input name="b_pnt" type="text" id="b_pnt" size="10" />
    </label></td>
    <td>ID:</td>
    <td><?php echo $counter; ?><input name="id" type="hidden" id="id" value="<?php echo $counter; ?>" /></td>
  </tr>
</table>

<?php
if ($num == $counter){ print '<hr />'; }
}
print '</form>';
include ($path."main/include/cons/foot.php");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.