Here is the generatepdf.php:
<?php
include('db.php');
require_once 'vendor/autoload.php';
ob_start();
?>
<?php
$student_id = 0;
if (isset($_GET['id'])) {
$student_id = $_GET['id'];
}
// var_dump($student_id);
$fetchUser = $conn->query("SELECT * from student where id = $student_id")->fetchAll(PDO::FETCH_ASSOC);
$subjects = $conn->query("SELECT * FROM subjects WHERE student_id = $student_id")->fetchAll(PDO::FETCH_ASSOC);
//
// var_dump($fetchUser);
// Student Info
$name = $fetchUser[0]['name'];
$rollno = $fetchUser[0]['rollno'];
$image = $fetchUser[0]['image'];
$center = $fetchUser[0]['center'];
$division = $fetchUser[0]['division'];
$academic_year = $fetchUser[0]['academic_year'];
$class = $fetchUser[0]['class'];
$session = $fetchUser[0]['session1'] . ' - ' . $fetchUser[0]['session2'];
$father = $fetchUser[0]['father'];
$stream = $fetchUser[0]['stream'];
$totalmarks = $fetchUser[0]['totalmarks'];;
$obtmarks = $fetchUser[0]['obtmarks'];
$marksinwords = $fetchUser[0]['marksinwords'];
$percentage = ($fetchUser[0]['obtmarks'] / $fetchUser[0]['totalmarks']) * 100;
$percentage = number_format($percentage, 2);
$todaysDate = gmdate("M d, Y", strtotime('now'));
$html = '
<html>
<head>
<style>
body {font-family: sans-serif;
font-size: 10pt;
}
p { margin: 0pt; }
table.items {
border: 0.1mm solid #000000;
}
td { vertical-align: top; }
.items td {
border-left: 0.1mm solid #000000;
border-right: 0.1mm solid #000000;
}
table thead td { background-color: #EEEEEE;
text-align: center;
border: 0.1mm solid #000000;
font-variant: small-caps;
}
.items td.blanktotal {
background-color: #EEEEEE;
border: 0.1mm solid #000000;
background-color: #FFFFFF;
border: 0mm none #000000;
border-top: 0.1mm solid #000000;
border-right: 0.1mm solid #000000;
}
.items td.totals {
text-align: right;
border: 0.1mm solid #000000;
}
.items td.cost {
text-align: "." center;
}
</style>
</head>
<body>
<!--mpdf
<htmlpageheader name="myheader">
<table width="100%"><tr>
<td width="80%" style="color:#000; "><span style="font-weight: bold; font-size: 14pt;">Online Marksheet For TELEGANA UNIVERSITY</span></td>
// <td width="20%" style="text-align: right;">Date: ' . $todaysDate . '<br />
</tr></table>
</htmlpageheader>
<htmlpagefooter name="myfooter">
<div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; ">
Page {PAGENO} of {nb}
</div>
</htmlpagefooter>
<sethtmlpageheader name="myheader" value="on" show-this-page="1" />
<sethtmlpagefooter name="myfooter" value="on" />
mpdf-->
<img style="margin-top: -50px;padding: 15px; border: 2px solid #000; height: 100px;margin: auto !important;width: 100px;background-size: contain;background-repeat: no-repeat;background-position: center;margin-left: 80px !important;" src="images/' . $image . '" class="img-thumbnail">
<table width="100%" style="font-family: serif;" cellpadding="10"><tr>
<td width="55%"><br /><br /><span style="font-weight: bold;">Name:</span> ' . $name . '<br /><span style="font-weight: bold;">Father:</span> ' . $father . '<br /><span style="font-weight: bold;">Center:</span> ' . $center . '<br /><span style="font-weight: bold;">Division:</span> ' . $division . '<br /><span style="font-weight: bold;">Class:</span> ' . $class . '</td>
<td width="5%"> </td>
<td width="40%"><br /><br /><span style="font-weight: bold;">Hall Ticket / Roll No:</span> ' . $rollno . '<br /><span style="font-weight: bold;">Session:</span> ' . $session . '<br /><span style="font-weight: bold;">Stream:</span> ' . $stream . '<br /><span style="font-weight: bold;">Year of Passing:</span> ' . $academic_year . '</td>
</tr></table>
<br />
<table class="items" width="100%" style="font-size: 9pt; border-collapse: collapse; " cellpadding="8">
<thead>
<tr>
<td width="15%">Sub Code</td>
<td width="40%">Subject Name</td>
<td width="10%">Theory</td>
<td width="15%">Practicals</td>
<td width="20%">Marks Secured</td>
</tr>
</thead>
<tbody>
<!-- ITEMS HERE -->
';
foreach ($subjects as $subject) {
$html .= '<tr>';
$html .= '<td align="center">' . $subject['subcode'] . '</td>';
$html .= '<td align="center">' . $subject['subject_name'] . '</td>';
$html .= '<td>' . $subject['total_marks'] . '</td>';
$html .= '<td class="cost">' . $subject['obtained_marks'] . '</td>';
$html .= '<td class="cost">' . $subject['marksinwords'] . '</td>';
$html .= '</tr>';
}
$html .= '
<tr style="border-top: 2px solid #000;">
<td style="border-top: 2px solid #000;" align="center" >Percentage: ' . $percentage . '</td>
<td style="border-top: 2px solid #000;" align="center"></td>
<td style="border-top: 2px solid #000;">' . $totalmarks . '</td>
<td style="border-top: 2px solid #000;" class="cost">' . $obtmarks . '</td>
<td style="border-top: 2px solid #000;" class="cost">' . $marksinwords . '</td>
</tr>
</tbody>
</table>
</body>
</html>
';
require_once 'bootstrap.php';
$mpdf = new \Mpdf\Mpdf([
'margin_left' => 10,
'margin_right' => 10,
'margin_top' => 30,
'margin_bottom' => 25,
'margin_header' => 10,
'margin_footer' => 10
]);
$mpdf->SetTitle("Online Marksheet");
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output();
This is working perfectly fine in XAMPP for me, and is downloading the PDF every time I load the page.
But when I hosted these exact same files on cPanel's File Manager - it's only showing me a blank page. No errors. What can I do?
I've checked the PHP versions of both my XAMPP (v8.0) and PHP(v7.3) but that doesn't seem to be the issue (unless one of you think it is?)
To Troubleshoot:
Comment out
$mpdf->WriteHTML($html);
$mpdf->Output();
instead, just echo $html; first, just to see if all is correct.
Why?
Make sure that your html is not malformed.
If there's error messages or any php headers are sent already PDF will be corrupted and will show error on render.
Things to check before output();
All paths include/require paths are still correct or you uploaded them differently than your XAMPP?
Why ob_start() but I do not see where you ob_get_contents() and ob_end_clean() in the code? Effectively it would keep buffering without outputting. Server might be more strict than your XAMPP and gives you warning.
After all errors checked, paths corrected if were incorrect - your user input is not santised thats a big NO NO.
regarding your it's only showing me a blank page. No errors. What can I do? statement. There's either critical error and you need to check logs.
In this case, likely "require" path to bootstrap is incorrect.
If it's no errors in error logs, then likely your ob_start() would forbid you from outputting anything.
In my pages (I rent a programmer who made this... and I'm trying fix everything done badly...) I have problem with part of signpost. Its part of code which make different list depending on steps before, and when you move with your mouse over one of the item of this list, its "shows" some text on the left side...
He used table I try to change it from table to <li> but nothing changed...
Problem is that every text is begin from a row of marked item of the list and I would like to start from first row of the table ....
Here is part of code...
while ($rowshowvarianty = mysqli_fetch_array($resultshowvarianty)){
echo '<tr id="line" class="line">
<td style=" line-height: 25px; ">
<span style="width:250px; background: #e74c3c;color: white;border-radius: 50%;
padding: 0px 7.5px;">?</span>
</td>
<td style=" font-size: 13px; width: 100%; ">
<a style="text-decoration: none; color: #232323;"
href="?step=3&cil='.$_GET['cil'].'
plan='.$rowshowvarianty['id'].'">'.$rowshowvarianty['nazev'].'</a>
</td>';
echo '<td style="width:400px; top: 0px; margin-left: -400px; position:absolute; ">
<span class="hiddentooltip" id="'.$rowshowvarianty['id'].'">'
.$rowshowvarianty['pruvodce'].'</span>
</td></tr>';
}
CSS:
.line:hover .hiddentooltip,
.line:hover ~ .hiddentooltip{
left: -400px;
float: right;
position: absolute;
width: 100%;
height: 100vh; display: block;
}.line td:nth-child(2) {
max-width: 350px !important;
width: 30% !important;
text-align: left;
padding-left: 10px;
}
.hiddentooltip{
display: none;
padding: 0px 30px;
font-size: 11px;
line-height: 18px;
for this time im done, i have to check it on other devices but... this is runs as I wanted to...
while ($rowshowvarianty = mysqli_fetch_array($resultshowvarianty)) {
echo '<tr id="line" class="line">
<td style="line-height: 25px; ">
<span style="width:250px; background: #e74c3c;color: white;border-radius: 50%; padding: 0px 7.5px;">
?
</span>
</td>
<td style=" font-size: 13px; width: 100%; ">
<a style="text-decoration: none; color: #232323;" href="?step=3&cil=' . $_GET['cil'] . '&plan=' . $rowshowvarianty['id'] . '">' . $rowshowvarianty['nazev'] . '</a>
</td>';
$vs='width:400px; margin-left: -400px; position: absolute; top:' .-($nsb*28) . 'px;';
$nsb++;
echo '
<td style="' . $vs . '">
<span class="hiddentooltip" id="' . $rowshowvarianty['id'] . '">
' . $rowshowvarianty['pruvodce'] . '
</span>
</td>
</tr>';
}
I never though this could be an issue at all! I have a div element placed inside a td, which I want to display as a circle.
Here is the code:
<table>
<tr>
<td><div style="width: 20px; height: 20px; border-radius: 50%;-moz-border-radius: 50%;-webkit-border-radius: 50%; background: #ffcc00;color: #000;">!</div></td>
<td>Something else...</td>
<tr>
</table>
The above HTML markup is actually being created and returned from a function like this:
protected function disclaimer_markup( $link ) {
$sensitive = $link->is_sensitive;
$disclaimer = "";
if( "on" == $sensitive) {
$disclaimer = '<table style="margin: 0 25px 10px 25px;border-top: 1px solid #f58353; border-bottom: 1px solid #f58353;font-family: \'Noto\', sans-serif;">';
$disclaimer .= '<tr>';
$disclaimer .= '<td style="width: 20px; font-size: 18px;color: #f58353;">';
$disclaimer .= '<div style="width: 20px; height: 20px;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;background: #f58353; color: #ffffff; text-align: center;font-weight: bold;border-collapse: separate;">!</div>';
$disclaimer .= '</td>';
$disclaimer .= '<td style="font-size: 12px; width: color: #f58353;font-style: italic;"><span style="color: #f58353;">This article has been shared with employees only. Some information in this article may not be appropriate to share with customers or external audiences</span></td>';
$disclaimer .= '</tr>';
$disclaimer .= '</table>';
}
return $disclaimer;
}
The border radius does not work at all. I checked both Chrome and Firefox.
The most surprising thing is when I checked page source, the entire border-radius properties are simply ignored and not rendered at all!
The rendered output looks like this:
<div style="width: 20px; height: 20px; background: #ffcc00;color: #000;">!</div>
What's went wrong? Please suggest.
I've been trying to figure out why everything seems to work perfectly, but no emails are ever sent.
I contacted Godaddy, they checked everything on there end, and even sent an email from my site that i was able to receive. Right now I'm just working on a basic contact form, but have a much larger project in the making, and would like my web builder to handle the small form first.
Here is the Code from the html/Form side:
<form id="imObjectForm_8" action="mail/imEmailForm.php" method="post" enctype="multipart/form-data" style="width: 505px; margin: 0; padding: 0; text-align: left;">
<fieldset class="first">
<div>
<div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_8_1" style="vertical-align: top; display: inline-block; margin: 3px 0 2px; width: 246px;">Name*</label><br /><input type="text" class="mandatory" style="float: left; width: 220px; margin-right: 2px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_8_1" name="imObjectForm_8_1" /><img id="imObjectForm_8_1_tip" src="res/info.gif" title="" onmouseover="x5engine.imTip.Show(this, { text: 'Enter your name here.', position: 'top' })" alt="Tip" style="vertical-align: top; margin-top: 5px;" /></div>
<div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_8_2" style="vertical-align: top; display: inline-block; margin: 3px 0 2px; width: 246px;">Email*</label><br /><input type="text" class="mandatory valEmail" style="float: left; width: 220px; margin-right: 2px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_8_2" name="imObjectForm_8_2" /><img id="imObjectForm_8_2_tip" src="res/info.gif" title="" onmouseover="x5engine.imTip.Show(this, { text: 'Enter your email address here.', position: 'top' })" alt="Tip" style="vertical-align: top; margin-top: 5px;" /></div>
<div class="imClear" style="height: 1px; line-height: 1px; width: 505px;"></div>
<div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_8_3" style="vertical-align: top; display: inline-block; margin: 3px 0 2px; width: 246px;">Reason for contact*</label><br /><select class="mandatory" style="float: left; width: 220px; margin-right: 2px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_8_3" name="imObjectForm_8_3"><option value="">-</option><option value="Questions">Questions</option><option value="Comments">Comments</option><option value="Suggestions">Suggestions</option><option value="Requests">Requests</option><option value="Other">Other</option></select><img id="imObjectForm_8_3_tip" src="res/info.gif" title="" onmouseover="x5engine.imTip.Show(this, { text: 'Select the reason you are contacting us.', position: 'top' })" alt="Tip" style="vertical-align: top; margin-top: 5px;" /></div>
<div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_8_4" style="vertical-align: top; display: inline-block; margin: 3px 0 2px; width: 246px;">Phone #</label><br /><input type="text" class="" style="float: left; width: 220px; margin-right: 2px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_8_4" name="imObjectForm_8_4" /><img id="imObjectForm_8_4_tip" src="res/info.gif" title="" onmouseover="x5engine.imTip.Show(this, { text: 'Phone # is optinal, but suggested if requesting we contact your back.', position: 'top' })" alt="Tip" style="vertical-align: top; margin-top: 5px;" /></div>
<div class="imClear" style="height: 1px; line-height: 1px; width: 505px;"></div>
<div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_8_5" style="vertical-align: top; display: inline-block; margin: 3px 0 2px; width: 499px;">Message*</label><br /><textarea class="mandatory" style="float: left; width: 473px; margin-right: 2px; vertical-align: top; padding-top: 2px; padding-bottom: 2px; padding-left: 0; padding-right: 0; height: 130px;" id="imObjectForm_8_5" name="imObjectForm_8_5"></textarea><img id="imObjectForm_8_5_tip" src="res/info.gif" title="" onmouseover="x5engine.imTip.Show(this, { text: 'Enter your message here.', position: 'top' })" alt="Tip" style="vertical-align: top; margin-top: 5px;" /></div>
</div>
</fieldset>
<fieldset>
<input type="hidden" id="imObjectForm_8_prot" name="imSpProt" />
</fieldset>
<div style="width: 505px; text-align: center;">
<input type="submit" value="Send" />
<input type="reset" value="Reset" />
</div>
</form>
Here is the PHP file:
<?php
$settings['imEmailForm_19_8'] = array(
"owner_email_from" => "Email",
"owner_email_to" => "noah_swett#yahoo.com",
"customer_email_from" => "noah_swett#yahoo.com",
"customer_email_to" => "",
"owner_message" => "New email from the website. message:",
"customer_message" => "",
"owner_subject" => "New Message",
"customer_subject" => "",
"owner_csv" => False,
"customer_csv" => False,
"confirmation_page" => "../confirmation.html"
);
if(substr(basename($_SERVER['PHP_SELF']), 0, 11) == "imEmailForm") {
include "../res/x5engine.php";
$answers = array(
);
$form_data = array(
array('label' => 'Name', 'value' => $_POST['imObjectForm_8_1']),
array('label' => 'Email', 'value' => $_POST['imObjectForm_8_2']),
array('label' => 'Select', 'value' => $_POST['imObjectForm_8_3']),
array('label' => 'Your Message', 'value' => $_POST['imObjectForm_8_4'])
);
$files_data = array(
);
if(#$_POST['action'] != "check_answer") {
if(!isset($_POST['imJsCheck']) || $_POST['imJsCheck'] != "jsactive")
die(imPrintJsError());
if (isset($_POST['imCpt']) && !isset($_POST['imCptHdn']))
die(imPrintJsError());
if(isset($_POST['imSpProt']) && $_POST['imSpProt'] != "")
die(imPrintJsError());
$email = new imSendEmail();
$email->sendFormEmail($settings['imEmailForm_19_8'], $form_data, $files_data);
#header('Location: ' . $settings['imEmailForm_19_8']['confirmation_page']);
} else {
if(#$_POST['id'] == "" || #$_POST['answer'] == "" || strtolower(trim($answers[#$_POST['id']])) != strtolower(trim(#$_POST['answer'])))
echo "0";
else
echo "1";
}
}
Code from imengine.php
function sendFormEmail($form, $form_data, $files_data, $user_only = FALSE) {
global $imSettings;
if (!is_array($form))
$settings = $imSettings['email_form'][$form_id];
else
$settings = $form;
//Form Data
$txtData = "";
$htmData = "";
$csvHeader = "";
$csvData = "";
$customer_email_to = "";
$owner_email_from = "";
foreach ($form_data as $field) {
if (is_array($field['value'])) {
$txtData .= $field['label'] . ": " . implode(", ", $field['value']) . "\r\n";
$htmData .= "<tr valign=\"top\"><td width=\"25%\"><b>" . $field['label'] . ":</b></td><td>" . implode(", ", $field['value']) . "</td></tr>";
if ($settings['customer_csv'] || $settings['owner_csv']) {
$csvHeader .= $field['label'] . ";";
$csvData .= implode(", ", $field['value']) . ";";
}
} else {
if (isset($settings['customer_email_to']) && $field['label'] == $settings['customer_email_to'])
$customer_email_to = $field['value'];
if (isset($settings['owner_email_from']) && $field['label'] == $settings['owner_email_from'])
$owner_email_from = $field['value'];
$txtData .= $field['label'] . ": " . $field['value'] . "\r\n";
// Is it an email?
if (preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\#([a-z0-9])' . '(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i',$field['value'])) {
$htmData .= "<tr valign=\"top\"><td width=\"25%\"><b>" . str_replace(array("\\'", '\\"'), array("'", '"'), $field['label']) . ":</b></td><td>". $field['value'] . "</td></tr>";
} else if (preg_match('/^http[s]?:\/\/[a-zA-Z0-9\.\-]{2,}\.[a-zA-Z]{2,}/', $field['value'])) {
// Is it an URL?
$htmData .= "<tr valign=\"top\"><td width=\"25%\"><b>" . str_replace(array("\\'", '\\"'), array("'", '"'), $field['label']) . ":</b></td><td>". $field['value'] . "</td></tr>";
} else {
$htmData .= "<tr valign=\"top\"><td width=\"25%\"><b>" . str_replace(array("\\'", '\\"'), array("'", '"'), $field['label']) . ":</b></td><td>" . str_replace(array("\\'", '\\"'), array("'", '"'), $field['value']) . "</td></tr>";
}
if ($settings['customer_csv'] || $settings['owner_csv']) {
$csvHeader .= str_replace(array("\\'", '\\"'), array("'", '"'), $field['label']) . ";";
$csvData .= str_replace(array("\\'", '\\"'), array("'", '"'), $field['value']) . ";";
}
}
}
// Template
$htmHead = $imSettings['email']['header'];
$htmFoot = $imSettings['email']['footer'];
//Send email to owner
if (!$user_only && isset($settings['owner_email_to']) && $settings['owner_email_to'] != "") {
$txtMsg = $settings['owner_message'];
$htmMsg = nl2br($settings['owner_message']);
if (strpos($owner_email_from, "#") === FALSE || strlen($owner_email_from) == 0)
$owner_email_from = $settings['owner_email_to'];
$oEmail = new imEMail($owner_email_from, $settings['owner_email_to'], $settings['owner_subject'], "utf-8");
$oEmail->setText($txtMsg . "\n\n" . $txtData);
$oEmail->setHTML($htmHead . $htmMsg . "<br><br><table border=0 width=\"100%\" style=\"" . $imSettings['email']['email_content_style'] . "\">" . $htmData . "</table>" . $htmFoot);
if ($settings['owner_csv'])
$oEmail->attachFile("form_data.csv", $csvHeader . "\n" . $csvData, "text/csv");
if (count($files_data) > 0) {
foreach ($files_data as $file) {
if (file_exists($file['value']['tmp_name']))
$oEmail->attachFile($file['value']['name'], file_get_contents($file['value']['tmp_name']), $file['value']['type']);
}
}
$oEmail->send();
}
//Send email to user
if ($customer_email_to != "") {
$txtMsg = $settings['customer_message'];
$htmMsg = nl2br($settings['customer_message']);
if ($settings['customer_email_from'] == "")
$settings['customer_email_from'] = $settings['owner_email_to'];
$oEmail = new imEMail($settings['customer_email_from'], $customer_email_to, $settings['customer_subject'], "utf-8");
if ($settings['customer_csv']) {
$oEmail->setHTML($htmHead . $htmMsg . "<br><br><table border=0 width=\"100%\" style=\"" . $imSettings['email']['email_content_style'] . "\">" . $htmData . "</table>" . $htmFoot);
$oEmail->setText($txtMsg . "\n\n" . $txtData);
} else {
$oEmail->setText($txtMsg);
$oEmail->setHTML($htmHead . $htmMsg . $htmFoot);
}
$oEmail->send();
}
}
Please help!
I have a search form the searches through a packaging database. Everything works fine and dandy, when the search from is submitted I get returned results on a different page displayed in styled boxes with a picture. But unfortunately the seem to display one after another underneath each other. Although it is good that they are returning and I am getting the correct results. I want to be able to display three next to each other, then they go to the next row and display three more, so on and so forth until I have run out of results.
Here is the PHP:
<?php
$con = mysql_connect ("localhost", "horizon1", "D2j616H5O#Lw");
mysql_select_db ("horizon1_delyn", $con);
if (!$con)
{
die ("Could not connect: " . mysql_error());
}
$descrip = mysql_real_escape_string($_POST['descrip']);
$depth = mysql_real_escape_string($_POST['depth']);
$varWidth = mysql_real_escape_string($_POST['traywidth']);
$varHeight= mysql_real_escape_string($_POST['trayheight']);
$varRange = mysql_real_escape_string($_POST['trayrange']);
$varType = mysql_real_escape_string($_POST['traytype']);
$varShape = mysql_real_escape_string($_POST['trayshape']);
$varImage = mysql_real_escape_string($_POST['imagename']);
if (isset($varHeight) && !empty($varHeight)) {
$low = ($varHeight."00");
$high = ($varHeight."99");
} else {
$low = ("000");
$high = ("999");
}
if (isset($varWidth) && !empty($varWidth)) {
$min = ($varWidth."00");
$max = ($varWidth."99");
} else {
$min = ("000");
$max = ("999");
}
$sql = "SELECT * FROM range WHERE
description LIKE '%".$descrip."%'
AND trayrange LIKE '%".$varRange."%'
AND traytype LIKE '%".$varType."%'
AND trayshape LIKE '%".$varShape."%'
AND traywidth BETWEEN '".$min."' AND '".$max."'
AND trayheight BETWEEN '".$low."' AND '".$high."' ";
$r_query = mysql_query($sql);
while ($row = mysql_fetch_array($r_query))
{
echo '<div id="results">';
echo '<p class="image">
<img src=" '. $row['imagename'] . '" width="150" length="80">
</p>';
echo '<div id="table"><br />
<strong> Tool Code: </strong> '. $row['toolcode'];
echo '<br /><strong> Description: </strong> '. $row['description'];
echo '<br /><strong> Tray range: </strong> '. $row['trayrange'];
echo '<br /><strong> Tray type: </strong> '. $row['traytype'];
echo '<br /><strong> Tray size: </strong> '. $row['traysize'];
echo '<br /><strong> Tray shape: </strong> '. $row['trayshape'] . '</div>' . '<br />';
echo 'Enquiry Page <br />' .
'Back to Search';
echo '</div>' . '<br />';
}
if (mysql_num_rows($r_query) <= 0){
echo 'No results match your search, please try again';
}
?>
And here is the CSS:
<style>
#boxes {
padding: 10px;
margin-top: 20px;
margin: 10px;
float: left;
display: block;
}
#results {
width: 212px;
padding: 5px;
background: #E8CF24;
display: block;
overflow:auto;
font-family: Verdana, Geneva, sans-serif;
font-size: 11px;
font-color: #FFF;
border: 2px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
#table {
margin-top: 10px;
width: 200px;
padding: 3px;
background: #FFF;
display: block;
overflow:auto;
border: 2px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
.image {
margin-left: 28px;
margin-bottom: 0px;
margin-top: 5px;
}
a:link {
color: #000423;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
</style>
I have tried to edit it with the CSS but I can change the position and padding, margins and so on forth. But I can't get them to align next to each other.
Anyone able to help? Thanks in advance :)
In your css add this to your #results selector.
#results {
float:left
}
EDIT: Sorry that was not the correct answer. Delete the above code and look into thee below code.
Replace the while loop with the below code.
EDIT: Dont forget to initialize the $count variable. ($count = 0;)
Just copy-paste the code and it should work for you.
$count = 0;
while ($row = mysql_fetch_array($r_query))
{
$t = $count%3;
echo ($t==2) ? '<div id="results">' : '<div id="results" style="float:left">';
echo '<p class="image">
<img src=" '. $row['imagename'] . '" width="150" length="80">
</p>';
echo '<div id="table"><br />
<strong> Tool Code: </strong> '. $row['toolcode'];
echo '<br /><strong> Description: </strong> '. $row['description'];
echo '<br /><strong> Tray range: </strong> '. $row['trayrange'];
echo '<br /><strong> Tray type: </strong> '. $row['traytype'];
echo '<br /><strong> Tray size: </strong> '. $row['traysize'];
echo '<br /><strong> Tray shape: </strong> '. $row['trayshape'] . '</div>' . '<br />';
echo 'Enquiry Page <br />' .
'Back to Search';
echo '</div>';
$count++;
}
This is what i get. I didnt use the css file.