Jump to content

speedy33417

Members
  • Posts

    80
  • Joined

  • Last visited

    Never

Everything posted by speedy33417

  1. Thanks for your help. Not really at I was looking for though. My code is only part of what it should be. It should do the following when numpics=4 [code] <td>display pic</td> <td>display pic</td> <td>display pic</td> <td>display pic</td> [/code] and should do the following if numpics=2 [code] <td>display pic</td> <td>display pic</td> <td></td> <td></td> [/code] I still need to echo 2 empty td's for my table to look good. Thanks again.
  2. I'm working on a photo album and I have a small problem with an if statement that use when I'm displaying the thumbs of my pics. There should be 4 pics in a row, like so: 1234 5678 Right now I'm only working on displaying the first row with the 4 pics My code works fine like this: [code]<?php         $numcol = 1; ?> blah blah <div align="center">         <table border="0" width="648" cellpadding="5" cellspacing="2">                 <tr>                         <?php                                 while ($numcol < 5) {                                         echo "<td width=\"162\" bgcolor=\"#e6e6e6\" valign=\"top\"><p align=\"center\">";                                         echo "<img border=\"0\" src=\"images/somepic.jpg\" width=\"150\" height=\"113\"><br>";                                         echo "<span class=\"text1\"><b>some text</b><br>some text<br>some text<br></span>";                                         echo "</p></td>";                                         $numcol++;                                 }                         ?>                 </tr>         </table> </div>[/code] However this code will only work properly if I have exactly 4 pics left to display. For this reason I added an if statement with an empty <td></td> to be poked in if there's no pic left to display to fill up my row with 4 td's Here's my code with the if statement that doesn't work: [code]<?php         $numpicsleft=2;         $numcol = 1; ?> blah blah <div align="center">         <table border="0" width="648" cellpadding="5" cellspacing="2">                 <tr>                         <?php                                 while ($numcol < 5) {                                         if($numpicsleft > 1) {                                                 echo "<td width=\"162\" bgcolor=\"#e6e6e6\" valign=\"top\"><p align=\"center\">";                                                 echo "<img border=\"0\" src=\"images/somepic.jpg\" width=\"150\" height=\"113\"><br>";                                                 echo "<span class=\"text1\"><b>some text</b><br>some text<br>some text<br></span>";                                                 echo "</p></td>";                                                 $numcol++;                                                 $numpicsleft--;                                         } else {                                                 echo "<td width=\"162\"></td>";                                         }                                 }                         ?>                 </tr>         </table> </div>[/code] Can anyone see why? It seems to be going into an eternal loop for some reason... Thanks.
  3. Quick question. How do you assign value to a variable based on which link the user clicks. One of the pages where I would use it is a photo gallery page. Clicking on a thumbpic would save the album_id in a variable then process the page based on that variable. album_view.php checks if there's a value assigned to the variable. If not that means it will display the main gallery, if there's a value assigned to it then it will display that sub-gallery. Thanks.
  4. I was going to get it verified on the next page, but now that you ask me is it possible to do it on the same page? But getting back to the way I wanted to do it. I hear about all these super globals at what not. I wanted to make sure that my first page is all done before I worry about the second one. Do I need to start a session on index.php or it's good as is?
  5. First time posting here. New to php. ;D I'm trying to use sessions for an html form to process user ID and password. index.php receives two variables that need to be global variables which will be carried over to loggedin.php and verified either invalid user id and/or password or access to that page. My problem is the first half: index.php This is what I have so far: [code] <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <link rel="stylesheet" type="text/css" href="inc/theme.css"> </head> <body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0" marginheight="0" marginwidth="0">   <form name="logForm" action="loggedin.php">     <div align="center">       <table border="0" width="610" cellpadding="0" cellspacing="0">         <tr>           <td width="105" valign="top"><span class="text1">&nbsp;user ID</span></td>           <td width="105" valign="top"><span class="text1">&nbsp;password</span></td>           <td width="400"></td>         </tr>         <tr>           <td width="105" valign="top"><input name="userId" class="form3"></td>           <td width="105" valign="top"><input name="passWord" class="form3"></td>           <td width="400" valign="bottom"><a href="javascript:if(document.logForm.onsubmit())document.logForm.submit()" class="text1">Log in</a></td>         </tr>       </table>     </div>   </form>           </body> </html> [/code] I need help inserting the session for those variables so after submitting, they can be called with a session_start on loggedin.php.
×
×
  • 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.