Placement of images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
billrush
Forum Newbie
Posts: 3
Joined: Fri May 02, 2003 9:37 am

Placement of images

Post by billrush »

I am new to PHP and am attempting to modify some code to place a small thumbnail image (.jpg) into an array. I almost succeeded, however I cannot get the syntax correct. I am looking for the correct syntax. I was unable to find the answer on PHP.net.

Here is the relevent section of the code:

$itemsFormat = "<tr><td align=\"left\"><span class=\"number\">" . $number . "</span></td><td align=\"left\"><span class=\"image\">"\"$imageDir" . $number . ".jpg\"<td align=\"left\"><span class=\"description\">" . $description .
"</a></span></td><td align=\"right\"><span class=\"price\">" . $price . "</span></td><td align=\"center\"><input type=\"text\" name=\"$numberquantity\" size=\"3\" class=\"box\"></td></tr>\n";
echo("$itemsFormat");

As you can see, I have the $imageDir element and it is pathed to the direcetory where my images are located. Also, the images are numbered.

Any help is appreciated.

Thanks,

Bill Rush
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Could you post the entire code?
billrush
Forum Newbie
Posts: 3
Joined: Fri May 02, 2003 9:37 am

Post by billrush »

Here is the entire index.php file.

Thanks,

Bill

<?php
include("top.inc");
if (!empty($_GET)) {
extract($_GET);
} else if (!empty($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
}

if (!empty($_POST)) {
extract($_POST);
} else if (!empty($HTTP_POST_VARS)) {
extract($HTTP_POST_VARS);
}


$imageDir="images/jpgimages/"

?>


<table
<tr height="100">
<td width="800" height="100" valign="top" align="center" cellpadding="3"><img

src="http://www.blackwing.com/images/logoqualitymeats.jpg" width="250" height="71" border="0">
</td>
<td width="1" height="50"><spacer type="block" width="1" height="50"></td>
</tr>
<td><font size="4" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" color="white"></font></div>
</td>
<tr><td width="800" align="center">
<font size="4"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Blackwing Online Order

Form<p><p/>
<div align="left">
<font size="2"><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">In order to use this form,

simply enter the quantity desired.
After entering your order, simply click the "Proceed" button to view your order before submitting. Please

make sure you enter your email address, name and phone number.</font>
</td></tr>
</table>

<form name="orderform" action="display.php" method="post">

<input type="submit" name="submitorder" value="Proceed" class="button"><p></p>


<table align="center" width="800" bgcolor="#333333" border="3" bordercolor="gray" cellspacing="0"

cellpadding="3">
<td>E-mail address:<input type="text" name="email" value="Enter email address" class="userentry"

style="color:red"><p></p>
Customer Name:<input type="text" name="name" value="Enter name" class="userentry"

style="color:red"><p></p>
Phone number:<input type="text" name="phone" value="Enter phone number" class="userentry"

style="color:red"><p></p>
Street Address:<input type="text" name="street" value="Enter street address" class="userentry"

style="color:red"><p></p>
City:<input type="text" name="city" value="Enter city" class="userentry" style="color:red"><p></p>
State:<input type="text" name="state" value="Enter state" class="userentry" style="color:red"><p></p>
Zip:<input type="text" name="zip" value="Enter zip" class="userentry" style="color:red">
<td>Ship To Address (if different from above)<p></p>
Street Address: <input type="text" name="streetship" value="Enter street address" class="userentry"

style="color:red"><p></p>
City: <input type="text" name="cityship" value="Enter city" class="userentry" style="color:red"><p></p>
State: <input type="text" name="stateship" value="Enter state" class="userentry"

style="color:red"><p></p>
Zip: <input type="text" name="zipship" value="Enter zip" class="userentry"

style="color:red"><p></p></td></table>


<table align="center" width="800" bgcolor="#333333" border="3" bordercolor="gray" cellspacing="0"

cellpadding="3"><tr><td><b>Item Number</b></td><td><b>Item Image</b></td><td><b>Item

Description</b></td><td width="60"><b>Unit Price</b></td><td width="60"

align="center"><b>Quantity</b></td></tr>


<?php

$file = file("items.db");
for($f = 0; $f < count($file); $f++)
{

$r_content = array_reverse($file);
$r_content = array_reverse($r_content);
$itemsInfo = $r_content[$f];
list($number, $description, $price) = explode('|||',$itemsInfo);

$numberquantity=$number.quantity;


$itemsFormat = "<tr><td align=\"left\"><span class=\"number\">" . $number . "</span></td><td

align=\"left\"><span class=\"image\"\"$imageDir" . $number . ".jpg\"><td align=\"left\"><span class=\"description\">" . $description .

"</a></span></td><td align=\"right\"><span class=\"price\">" . $price . "</span></td><td

align=\"center\"><input type=\"text\" name=\"$numberquantity\" size=\"3\" class=\"box\"></td></tr>\n";
echo("$itemsFormat");
}

?>

</table>

<input type="submit" name="submitorder" value="Proceed" class="button">

</form>

<?php
include("bottom.inc");
?>
Post Reply