Jump to content

kenjenn

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kenjenn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for helping.  full code: [code] <?php echo "<form name='attendance' action='$_SERVER[PHP_SELF]' method='POST'>"; echo "<input type='submit' value='Submit Changes'>"; $i=0; echo '<table>'; while ($row=mysql_fetch_row($result1)) {   $IDstudent=$row[0];   $name = $row[1];   $status = $row[2];     echo <<<HTML   <tr>     <td>       <input name='studentid[{$i}]' type='hidden' value='{$IDstudent}'>     </td>     <td>     {$name}     </td>     <td>       {$status}     </td>     <td>       <input name='status[{$i}]' type='radio' value='P'" . (strtolower($status) == 'p') ? "checked='checked'" : '';"> Present     </td>     <td>       <input name='status[{$i}]' type='radio' value='T'" . (strtolower($status) == 't') ? "checked='checked'" : '';"> Tardy     </td>     <td>       <input name='status[{$i}]' type='radio' value='U'" . (strtolower($status) == 'u') ? "checked='checked'" : '';"> Unexcused Absence     </td>     <td>       <input name='status[{$i}]' type='radio' value='E'" . (strtolower($status) == 'e') ? "checked='checked'" : '';"> Excused Absence     </td>   </tr>"; HTML; $i++; } echo "</table>"; ?>[/code]
  2. nope.  now I get 15 "; (double-quote semi-colon) above my empty table with 15 rows.
  3. no more errors, but all I get is a row of: checked='checked'checked='checked'checked='checked'checked='checked' etc.
  4. Did that and same error.  Current code is: [code] <?php echo "<form name='attendance' action='{$_SERVER[PHP_SELF]}' method='POST'>"; echo "<input type='submit' value='Submit Changes'>"; $i=0; echo '<table>'; while ($row=mysql_fetch_row($result1)) {   $IDstudent=$row[0];   $name = $row[1];   $status = $row[2];     echo "   <tr>     <td>       <input name='studentid[{$i}]' type='hidden' value='{$IDstudent}'>     </td>     <td>       {$name}     </td>     <td>       {$status}     </td>     <td>       <input name='status[{$i}]' type='radio' value='P'" . (strtolower($status) == 'p') ? "checked='checked'" : ''"> Present     </td>     <td>       <input name='status[{$i}]' type='radio' value='T'" . (strtolower($status) == 't') ? "checked='checked'" : ''"> Tardy     </td>     <td>       <input name='status[{$i}]' type='radio' value='U'" . (strtolower($status) == 'u') ? "checked='checked'" : ''"> Unexcused Absence     </td>     <td>       <input name='status[{$i}]' type='radio' value='E'" . (strtolower($status) == 'e') ? "checked='checked'" : ''"> Excused Absence     </td>   </tr>"; $i++; } echo "</table>"; ?>[/code]
  5. ignace, thanks for the tips.  I cut & pasted your code, but when I ran it I received the following parse error: Parse error: parse error, unexpected '"', expecting ',' or ';' in .... Any ideas?
  6. I'm trying to populate a radio-button form from MySQL but can't seem to get the right php worked out to display.  Here's what I've got: echo "<form name=attendance action=$_SERVER[PHP_SELF] method=POST>"; echo '<input type=submit value="Submit Changes">'; $i=0; echo '<table>'; while ($row=mysql_fetch_row($result1)) { $IDstudent=$row[0]; $name = $row[1]; $status = $row[2]; echo '<tr><input name=studentid['.$i.'] type=hidden value=' . $IDstudent . '><td>' . $name . '</td><td>' . $status . '</td><td><input name=status['.$i.'] type=radio value="P" <?php if($status=="P"){echo "checked"};?>>Present</td><td><input name=status['.$i.'] type=radio value="T" <?php if($status=="T"){echo "checked"};?>>>Tardy</td><td><input name=status['.$i.'] type=radio value="U" <?php if($status=="U"){echo "checked"};?>>Unexcused Absence</td><td><input name=status['.$i.'] type=radio value="E" <?php if($status=="E"){echo "checked"};?>>>Excused Absence</td></tr>'; ++$i; } Any help on getting the IF statement to work to "Check" the appropriate radio button? Thanks.
×
×
  • 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.