php - Passing variables to get the correct message -


i having trouble passing 2 variables correct statement displayed can 1 or other happen not both had comment out 1 of statements time being.

 <?php      if(strtotime($row['entry_cutoff_date']) < strtotime($today))   <td style='text-align: center;  padding-top:30px; padding-bottom:30px;'><a href='event-list.php' style="background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;"><b> closed <?php // echo $row ['entry_cutoff_date'];?></b></a><br><br>   if(strtotime($row['accept_entries_date']) > strtotime($today))  {?>   <td style='text-align: center;  padding-top:30px; padding-bottom:30px;'><a href='event-list.php' style="background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;"><b>registration opens on <?php echo $row['accept_entries_date'];?></b></a><br><br>-->         </td>       <?php      }      else      { ?>          <td style='text-align: center;'><a href='event.php'><img style='width: 137px; height: 65px;' alt='' src='images/signup_button.jpg' border='0'></a><br><hr>       </td>      <?php      }?>  

thanks in advance!

xxxx following code worked 1 variable , thakes me correct event id:

<?php                if(strtotime($row['entry_cutoff_date']) <   strtotime($today))         {?>         <td style='text-align: center;  padding-top:30px; padding- bottom:30px;'><a href='event-list.php' style="background:#428bca; border: 4px  solid #000; box-shadow: 1px 1px           3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 147px; color:#fff;"><b>closed</b></a><br><br>   </td>   <?php   } else { ?> <td style='text-align: center;'>   <form name="ingfrm" action="event.php" method="post"> <input type="hidden" name="txtevent_id" id="txtevent_id" value="<?php echo   $_session['event_id']; ?>" > <input type="submit"  style='background-image:   url(images/signup_button.jpg); color: transparent; width: 143px; height: 80px;'   alt='' border='0' name="submitimage" value="signup"> </form>  <br><br>   </td> <?php   }?>  

this got me correct message displayed sign button not go correct event id

if(strtotime($row['entry_cutoff_date']) < strtotime($today)){     $tstyle = ' padding-top:30px; padding-bottom:30px;';     $output = "<a href='event-list.php' style='background:#428bca; border:    5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height:   65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><strong>   closed ".$row['entry_cutoff_date']."</strong></a><br /><br />"; }elseif(strtotime($row['accept_entries_date']) > strtotime($today)){     $tstyle = ' padding-top:30px; padding-bottom:30px;';     $output = "<a href='event-list.php' style='background:#428bca; border:  5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><strong>registration opens on ".$row['accept_entries_date']."</strong></a><br /><br />"; }else{     $tstyle = '';     $output = "<a href='event.php'><img style='width: 137px; height: 65px;'   alt='' src='images/signup_button.jpg' border='0'></a><br /><hr />"; } ?> 

you have few issues code. in first variable have space between $row , array. haven't closed or reopened php tags. curly brackets havent been implimented properly, cleaned version of interpreted desired output be;

<?php        if(strtotime($row['entry_cutoff_date']) < strtotime($today)){         $output = "<td style='text-align: center;  padding-top:30px; padding-bottom:30px;'><a href='event-list.php' style='background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><b> closed ".$row['entry_cutoff_date']."</b></a><br><br></td>";     }elseif(strtotime($row['accept_entries_date']) > strtotime($today)){         $output = "<td style='text-align: center;  padding-top:30px; padding-bottom:30px;'><a href='event-list.php' style='background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><b>registration opens on ".$row['accept_entries_date']."</b></a><br><br></td>";     }else{         $output = "<td style='text-align: center;'><a href='event.php'><img style='width: 137px; height: 65px;' alt='' src='images/signup_button.jpg' border='0'></a><br><hr></td>";     }      echo $output;  ?> 

or

<?php        if(strtotime($row['entry_cutoff_date']) < strtotime($today)){         $tstyle = ' padding-top:30px; padding-bottom:30px;';         $output = "<a href='event-list.php' style='background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><strong> closed ".$row['entry_cutoff_date']."</strong></a><br /><br />";     }elseif(strtotime($row['accept_entries_date']) > strtotime($today)){         $tstyle = ' padding-top:30px; padding-bottom:30px;';         $output = "<a href='event-list.php' style='background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><strong>registration opens on ".$row['accept_entries_date']."</strong></a><br /><br />";     }else{         $tstyle = '';         $output = "<a href='event.php'><img style='width: 137px; height: 65px;' alt='' src='images/signup_button.jpg' border='0'></a><br /><hr />";     } ?>     <td style='text-align: center;<?=$tstyle;?>'><?=$output;?></td> 

editted users updated code:

<?php        if(strtotime($row['entry_cutoff_date']) < strtotime($today)){         $output = "<td style='text-align: center;  padding-top:30px; padding-bottom:30px;'><a href='event-list.php' style='background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><b> closed ".$row['entry_cutoff_date']."</b></a><br /><br /></td>";     }elseif(strtotime($row['accept_entries_date']) > strtotime($today)){         $output = "<td style='text-align: center;  padding-top:30px; padding-bottom:30px;'><a href='event-list.php' style='background:#428bca; border: 5px solid #000; box-shadow: 5px 5px 3px #666666; font-size: 16px; height: 65px;line-height: 16px; padding: 15px 30px; width: 137px; color:#fff;'><b>registration opens on ".$row['accept_entries_date']."</b></a><br /><br /></td>";     }else{         $output = "<td style='text-align: center;'>                      <form name='ingfrm' action='event.php' method='post'>                         <input type='hidden' name='txtevent_id' id='txtevent_id' value='".$_session['event_id']."' />                         <input type='submit'  style='background-image: url(images/signup_button.jpg); color: transparent; width: 143px; height: 80px;' alt='' border='0' name='submitimage' value='signup' />                      </form>                      <br /><br />                    </td>";     }      echo $output;  ?> 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -