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
https://forums.phpfreaks.com/topic/136914-solved-a-stupid-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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