I have a page that image gets uploaded to but the image are not the right way.
I know I need to use EXIF but I am new to this and lost where to start on this as it is in a while loop
can any one help me
thx jason
here is my code
<section class ="box_1">
<form id="evaluations" method="post" action="comments_page_add.php" enctype="multipart/form-data">`enter code here`
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Parent Entered</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td>
</tr>
<?php
while($rows = mysqli_fetch_array($results2)){
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="child[]" type="checkbox" id="child[]" value="<?PHP echo $rows['id']; ?>"></td>
<td bgcolor="#FFFFFF"><?php echo $rows['given_name']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['surname']; ?></td>
</tr>
<?php
}
?>
</table>
</section>
<section class ="box_3">
<?php
while($rows2 = mysqli_fetch_array($results3)){
?>
<table width="100%" border="2" bgcolor="#CCCCCC">
<tr>
<tr><td colspan="4" align="center"><img src='<?php echo $rows2['Photo_parth']; ?>' width='60%' height='150em'></td></tr>
<td align="center" bgcolor="#FFFFFF"><input name="image[]" type="checkbox" id="image[]" value="<?PHP echo $rows2['id']; ?>"></td>
<td bgcolor="#FFFFFF"><?php echo $rows2['id']; ?></td></tr>
<td bgcolor="#FFFFFF"><?php echo $rows2['date']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows2['time']; ?></td>
</tr>
</table>
<?php
}
?>
</table>
</section>
Related
currently im doing my final year project which is advising system for student. My problem is that admin cannot update a certain data of student. At my first try, it says that, admin done update student profile but when i check at the database it does not update at all. After that i change my code, it turns that the data is undefined variable and mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given.
(AdminUpdateStd.php)
<?php
include("db.php");
$StdId = $_GET['id'];
$sql="SELECT * from member where id='$StdId'";
$result=mysqli_query($db,$sql);
while($rows=mysqli_fetch_array($result)){
$student_id=$rows[0];
$student_name=$rows[3];
$student_email=$rows[5];
$student_address=$rows[4];
$student_tel=$rows[6];
$intake=$rows[7];
$total_cred=$rows[8];
$advisor=$rows[9];
}
?>
<form action ="AdminUpdateProcess.php" method="POST">
<div id="reg-head" class="headrg" align="center"><strong>Profile Student <?php echo "$StdId"; ?></strong></div>
<table width="350" height="200" border="1" align="center" cellpadding="2" cellspacing="0" bgcolor="#FFF">
<input type="hidden" name="student_id" value=" <?php echo "$student_id"; ?>">
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name">Full Name:</div></td>
<td class="tl-4"><?php echo "$student_name"; ?></td>
</tr>
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name">Email:</div></td>
<td class="tl-4"><?php echo "$student_email"; ?></td>
</tr>
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name">Adress:</div></td>
<td class="tl-4"><?php echo "$student_address"; ?></td>
</tr>
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name">Tel Number:</div></td>
<td class="tl-4"><?php echo "$student_tel"; ?></td>
</tr>
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name">Intake:</div></td>
<td class="tl-4"><input type="text" name="intake" <?php echo "$intake"; ?>></td>
</tr>
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name">Total Credit Hour:</div></td>
<td class="tl-4"><input type="text" name="total_credit" <?php echo "$total_cred"; ?>></td>
</tr>
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name">Advisor:</div></td>
<td class="tl-4"><input type="text" name="advisor_name" <?php echo "$advisor"; ?>></td>
</tr>
<tr id="lg-1">
<td class="tl-1"><div align="left" id="tb-name"> </div></td>
<td class="tl-4"><input type="submit" name="Update" <?php echo "value='UPDATE'"; ?>></a>
<button type="button">View Profile</button></td>
</tr>
</table>
</form>
(AdminUpdateProcess.php)
<?php
include("db.php");
$intake=$_POST['intake'];
$total_cred=$_POST['total_credit'];
$advisor=$_POST['advisor_name'];
$StdId = $_POST['student_id'];
if (isset ($_POST['Update'])) {
$UpdateQuery ="UPDATE member SET intake = '$intake', total_credit = '$total_cred', advisor_name = '$advisor' WHERE student_id ='$StdId'";
$res = mysqli_query ($UpdateQuery) or die ("Could not update".mysqli_error());
}
?>
I used php to generate rows of html table. Here is my code:
<?php $cols=mysql_num_rows($grds); ?>
<tr>
<td></td>
<?php do{ ?>
<td rowspan="<?php echo $cols; ?>" align="center">Internal<br />Grades</td>
<td colspan="2"> <?php echo strtoupper($row_grds['grade_name']);?></td>
<td align="center"><?php echo strtoupper($row_grds['igrade']);?></td>
</tr>
<?php } while ($row_grds=mysql_fetch_assoc($grds));?>
The html source generated by the above code is:
<tr>
<td></td>
<td rowspan="2" align="center">Internal<br />Grades</td>
<td colspan="2"> RHYMES</td>
<td align="center">B</td>
</tr>
<td rowspan="2" align="center">Internal<br />Grades</td>//I don't want this.
<td colspan="2"> CONVERSATION</td>
<td align="center">A</td>
</tr>
My expected output is:
<tr>
<td> </td>
<td rowspan="2"> Internal<br /> Grade</td>
<td colspan="2"> RHYMES</td>
<td align="center">B</td>
</tr>
<tr>
<td> </td>
<td colspan="2"> CONVERSATION</td>
<td align="center">A</td>
</tr>
<?php $i=0; while ($row_grds=mysql_fetch_assoc($grds)){ ?>
<tr>
<td></td>
<?php if($i==0): ?>
<td rowspan="<?php echo $cols; ?>" align="center">Internal<br />Grades</td>
<?php endif; ?>
<td colspan="2"> <?php echo strtoupper($row_grds['grade_name']);?></td>
<td align="center"><?php echo strtoupper($row_grds['igrade']);?></td>
</tr>
<?php $i++; } ?>
Am currently developing a web application which does the process of invoice etc.
Customer is using dot matrix printer to print invoice sheet. They said the requirement in printing as if there is more than 5 items in a sheet the rest should come as next sheet.
I have made that using PHP but i don't know how to print the next sheet in next page. It just prints as usual in sequence which results in a sheet printed in 2 pages. Any help or ideas will be appreciated. Below is the code how i generated sheet.
Thanks
<script type="text/javascript">
function printPage(){
var divElements = document.getElementById('printDataHolder').innerHTML;
var oldPage = document.body.innerHTML;
document.body.innerHTML="<link rel='stylesheet' href='css/common.css' type='text/css' /><body class='bodytext'>"+divElements+"</body>";
window.print();
document.body.innerHTML = oldPage;
}
</script>
<?php
$limit=5;
$cnt=0; // for table header and footer
$cnt2=1;// for no of rows count to print total values in end
$total=0;
?>
<div id="contentHolder" align="center">
<input type="button" value="Print" class="btnclass" onclick="printPage()" /> <input type="button" class="btnclass" value="Click to Proceed" style="width:100px;" onclick="Javascript:window.location.href='invoice.php';" />
<br />
<div id="printDataHolder">
<?php while($data=mysql_fetch_array($invcontents)){ ?>
<?php if($cnt==0){ ?>
<table width="800" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #4E9A91;">
<tr>
<td height="29" colspan="4" style="font-size:22px; padding-left:10px;"><strong>OvalTechnologies</strong></td>
</tr>
<tr>
<td colspan="4" style="padding-left:10px;"><?php echo($branchdetails['address']); ?></td>
</tr>
<tr>
<td height="19" colspan="4" style="padding-left:10px;">Website : www.ovaltechnologies.in Phone No : <?php echo($branchdetails['phoneno']); ?></td>
</tr>
<tr>
<td height="12" colspan="4" style="border-bottom:1px solid #4E9A91;"> </td>
</tr>
<tr>
<td height="28" colspan="3" style="padding-left:10px;">Customer Name : <?php echo($invtotal['customername']); ?></td>
<td width="226"> </td>
</tr>
<tr>
<td width="309" height="28" style="padding-left:10px;border-bottom:1px solid #4E9A91;">Invoice No : <?php echo($invoiceid); ?></td>
<td colspan="2" style="border-bottom:1px solid #4E9A91;">Paid As : <?php echo($invtotal['paidas']); ?></td>
<td style="border-bottom:1px solid #4E9A91;">Date : <?php echo(getonlydatefromdatetime(changefromdbdate($invtotal['invoicedate']))); ?></td>
</tr>
<tr>
<td height="28" class="rowborder" style="padding-left:10px;"><strong>Item Name</strong></td>
<td width="136" class="rowborder"><strong>Rate</strong></td>
<td width="129" class="rowborder"><strong>Qty</strong></td>
<td class="rowborder"><strong>Amount</strong></td>
</tr>
<?php } ?>
<tr>
<td align="center" height="28" style="padding-left:10px;"><?php echo($data['item']); ?> : <?php echo($data['brand']." "); ?><?php echo($data['type']); ?></td>
<td align="center"><?php echo($data['billedamount']); ?></td>
<td align="center"><?php echo($data['quantity']); ?></td>
<td align="center"><?php echo($data['billedamount']*$data['quantity']); ?></td>
</tr>
<?php
if($cnt2==$invcount){//printing emptylines to fill up page
for($i=$cnt+1;$i<$limit;$i++){
?>
<tr>
<td height="28" style="padding-left:10px;"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php
}
}//printing emptylines to fill page ends
?>
<?php if($cnt==$limit-1 || $cnt2==$invcount){ ?>
<?php if($invtotal['transport']!="") {?>
<tr>
<td style="padding-left:10px; border-top:1px solid #4E9A91;" class="rowborder" height="28">Transport : <?php echo($invtotal['transport']); ?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;">Transport Cost : <?php echo($invtotal['transportcost']); ?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;">Destination : <?php echo($invtotal['destination']); ?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;"> </td>
</tr>
<?php } ?>
<tr>
<td height="28" class="rowborder" style="border-top:1px solid #4E9A91;"> </td>
<td class="rowborder" style="border-top:1px solid #4E9A91;"><?php if($invtotal['transport']!="") {if($invtotal['addtransport']=="no"){echo("Transport Cost Not Added");}}?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;">Total</td>
<td class="rowborder" style="border-top:1px solid #4E9A91;"><?php echo($invtotal['totalamount']);?></td>
</tr>
<tr>
<td height="28"> </td>
<td> </td>
<td> </td>
<td align="center">Invoice Done By</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table><br />
<?php } ?>
<?php
$cnt++;
$cnt2++;
if($cnt==$limit){
$cnt=0;
}
} ?>
</div>
</div>
<?php
} ?>
do not see such options in http://www.php.net/manual/en/function.printer-set-option.php
but you can have look around the functions here http://www.php.net/manual/en/ref.printer.php
printer_start_doc — Start a new document
printer_start_page — Start a new page
I am designing a mobile helpdesk system for my department. I currently have an HTML form that submits data to a MySQL table. I then display that table on a separate page with checkboxes beside each line. Currently the complete button is coded to simply delete any record that is checked. However, pressing this button appears to do nothing. I am wondering what I am doing wrong.
Here is the code:
<?php
$host="localhost";
$username="root";
$password="";
$db_name="opentix";
$tbl_name="opentix";
//Connect and Select
mysql_connect("$host","$username","$password") or die("Cannot Connect");
mysql_select_db("$db_name")or die("Cannot Select Database");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
?>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="OpenTickets" method="post" action"">
<table width="400" border="0" cellspacing="3" cellpadding="0" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"></td>
<td align="center" colspan="15" bgcolor="#FFFFFF"><strong>Open Tickets</strong>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><strong></stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Ticket Number</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Time Created</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Room</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>If Other</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Problem Type</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Machine Name</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Operating System</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Problem Description</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Troubleshooting</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Request</stong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Email</stong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['tixnum']; ?>".</td>
<td bgcolor="#FFFFFF"><? echo $rows['tixnum']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['timecreated']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Room']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Other']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Type']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Name']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['System']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Problem']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Troubleshooting']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Request']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Email']; ?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="15" align="center" bgcolor="#FFFFFF"><input name="complete" type ="submit" id="complete" value="Complete"></td>
</tr>
<?php
if($complete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "DELETE FROM opentix WHERE id='$del_id'";
$result = mysql_querry($sql);
}
if($result){
echo"<meta http-equiv=\"refresh\"content=\"0;URL=pcsehelpdesk\completeopen.php\">";
}
}
mysql_close();
?>
</table>
</form>
</td>
</tr>
</table>
Any input into what I am doing wrong would be great.
Looks like you need to tell the form to post to itself. Add this to your tag:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>"
More reading here: http://tycoontalk.freelancer.com/php-forum/51903-php-self-submitting-form.html
I used the following code to display the event details fetched from the database.
<form name="event_form" id="event_form" action="" method="post" enctype="application/x-www-form-urlencoded">
<table width="765" border="0" align="left" cellpadding="0" cellspacing="0" >
<tr>
<td>
<table width="765" border="0" align="left" cellpadding="0" cellspacing="0" id="results" class="fronttbl">
<tr></tr>
<?php
$select = "SELECT * FROM `tbl_event`";
$select_event = mysql_query($select);
$select_num = mysql_num_rows($select_event);
if($select_num > 0)
{
while($fetch = mysql_fetch_array($select_event))
{
$feventid=$fetch['intEventid'];
$feventname=stripslashes(ucfirst($fetch['varEventname']));
$fDate=$fetch['varDate'];
$seperate=explode("-", $fDate );
$year=$seperate[0];
$month=$seperate[1];
$date=$seperate[2];
$fchiefguest=stripslashes(nl2br($fetch['varChiefguest']));
$fvenue=stripslashes($fetch['varVenue']);
$ftime=stripslashes($fetch['varTime']);
$feventdetails=stripslashes($fetch['varEventdetails']);
echo " ";
?>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30%" height="30" valign="top"><strong>Name of the event:</strong></td>
<td width="70%" height="30" valign="top"><?php echo $feventname; ?></td>
</tr>
<tr>
<td height="30" valign="top"><strong>Date of the event to be held:</strong></td>
<td height="30" valign="top"><?php echo $date.'-'.$month.'-'.$year; ?></td>
</tr>
<tr>
<td height="30" valign="top"><strong>Time of the Event:</strong></td>
<td height="30" valign="top"><?php echo $ftime; ?></td>
</tr>
<tr>
<td height="30" valign="top"><strong>Venue of the event:</strong></td>
<td height="30" valign="top"><?php echo $fvenue; ?></td>
</tr>
<tr>
<td height="30" valign="top"><strong>Name of the Chief Guest:</strong></td>
<td height="30" valign="top"><?php echo $fchiefguest; ?></td>
</tr>
<tr>
<td height="30" valign="top"><strong>Event Details:</strong></td>
<td height="30" valign="top"><?php echo $feventdetails; ?></td>
</tr>
</table>
<p style="border-bottom:1px dotted #CCCCCC;"></p>
</td></tr>
<?php }
}
?>
</table>
</td>
</tr>
</table>
<div id="pageNavPosition"></div>
</form>
I have date field in my database table and the input will be saved like the following format 2012-03-01.
I need my page displays the events order by recent date/month/year in the frontend. For example today's event should displayed first likewise. How can i do that?
Use ORDER BY (...is that what you meant)?
Change your query to:
SELECT *
FROM `tbl_event`
ORDER BY varDate DESC
as i understand use this function for front end:
function changeFormat( $date ){
$exp_date = explode('-', $date);
return $exp_date[2] . '-'.$exp_date[1].'-'.$exp_date[0];
}
example: echo changeFormat('2012-12-01'); will return 01-12-2012 and apply this in your while loop where you want to display your date