Jump to content

tables in php?


far5had

Recommended Posts

I'm quite new to the world of PHP scripting..just want to put the following codes in a table to make it look better...its basically a photo album..thanks

 

<?php

require("definitions1.php");

 

if(isset($_GET['id']))

  $id = $_GET['id'];

else

  $id = 71;

 

$first = 71;

$last = 76;

 

$jpgfile = $jpgdir."P".$id.".JPG";

 

$descfile = $descdir."P".$id.".TXT";

 

if(file_exists($descfile)){

  $handle = @fopen($descfile, "r");

  if ($handle) {

      while (!feof($handle)) {

          $buffer = fgets($handle, 4096);

          $description .= $buffer;

      }

      fclose($handle);

  }

}

else{

  $description = "NO DESCRIPTION";

}

 

error_reporting(E_ALL ^ E_NOTICE);

ini_set("display_errors", 1);

 

echo "<html><head>";

echo "<link rel='stylesheet' type='text/css' href='style1.css' />";

echo "<title>Flowers Gallery</title>";

echo "</head><body><center>";

echo "<h1>SPRING FLOWERS GALLERY</h1>";

echo "<p><img class=\"img_border\" src=\"$jpgfile\"></p>";

echo "<p>".$description."</p>";

 

if($id>$first){

  echo "<a href=".$self."?id=".($id-1).">PREVIOUS</a>   ";

}

if($id<$last){

  echo "<a href=".$self."?id=".($id+1).">NEXT</a>";

}

 

echo "</center></body></html>";

 

error_reporting(E_ALL ^ E_NOTICE);

ini_set("display_errors", 1);

?>

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/173050-tables-in-php/
Share on other sites

to make things easier you dont need to put all the html in echo tags you could just break out of the php ?>

 

then write your html and where you need to insert the php just open the php again if you want i could knock up a quick example

 

<form name="createthread" id="createthread" method="post" action="forum.php">
<table width="100%" border="0">
  <tr>
    <td><center>
              Create A New Thread:
            </center>User: <input type="text" maxlength="50" width="50" name="username" id="username" value="<?php echo $username; ?>" readonly="readonly"/></td>
    
    
  </tr>
  <tr>
    <td>New Thread Name:
              <input type="text" name="newthreadname" id="newthreadname" /></td>
   
  </tr>
  <tr>
    <td> <input type="hidden" name="time" id="time" value="<?php echo $time; ?>"/></td>
  
  </tr>
  <tr>
    <td><textarea rows="6" cols="60" name="post" id="post"/>
              </textarea></td>

  </tr>
  <tr>
    <td><input type="submit" name="submit" value="Submit New Thread" /></td>

  </tr>

</table>
</form>

Link to comment
https://forums.phpfreaks.com/topic/173050-tables-in-php/#findComment-912127
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.