i have a table has php variables fetched from mysql , the table is inside a Form , what i am trying to do is to display page to be printed for the user with a an invoice style layout, i tried to make a behavior that when the FORM Is submitted , a pop up page will come display the php variables data , which is doesn't work at all , i tried to display the content of popup page inside a regluar page , it worked ! , which means there is no problem with my php code .
here is the form page code :
<form action="../../printInvoice.php" method="post" onsubmit="MM_openBrWindow('../../printInvoice.php','Invoice','status=yes,scrollbars=yes')">
<table width="100%" border="0">
<tr>
<td align="left">Invoice:</td>
</tr>
<tr>
<td width="12%" height="39" bgcolor="#9DE3FB" align="center">Invoice Number</td>
<td width="12%" bgcolor="#9DE3FB" align="center">Event Name</td>
<td width="12%" bgcolor="#9DE3FB" align="center">Reservation Date</td>
<td width="12%" bgcolor="#9DE3FB" align="center">Quantity</td>
<td width="12%" bgcolor="#9DE3FB" align="center">Price Per Ticket</td>
<td width="12%" bgcolor="#9DE3FB" align="center">Total Price</td>
</tr>
<tr>
<td width="12%" height="39" align="center"><input type="text" name="invoiceId" readonly="readonly" value="<? echo $row['invoiceId']; ?>" class ="field-style"/></td>
<td width="12%" height="39" align="center"><input type="text" name="eventTitle" readonly="readonly" value="<? echo $row['name']; ?>" class="field-style" /></td>
<td width="12%" height="39" align="center"><input type="text" name="invoiceDate" readonly="readonly" value="<? echo $row['invoiceDate']; ?>" class="field-style" /></td>
<td width="12%" height="39" align="center"><input type="text" name="invoiceqty" readonly="readonly" value="<? echo $row['quantity'] ?>" class="field-style" /></td>
<td width="12%" height="39" align="center"><input type="text" name="invoicePPU" readonly="readonly" value="<? echo $row['price']; ?>" class="field-style" /></td>
<td width="12%" height="39" align="center"><input type="text" name="invoiceTotal" readonly="readonly" value="<? echo $row['totalPrice']; ?>" class="field-style" /></td>
</tr>
</table>
<br />
<input type="submit" value="Print Invoice" />
</form>
here is the popup window code (invoice layout to print ):
<table width="65%" border="1" cellspacing="5" cellpadding="5">
<tr>
<td colspan="5"><table width="100%" border="0" cellspacing="5" cellpadding="5">
<tr>
<td width="60%"><img src="images/Logo.png" /></td>
<td width="40%"><p>Invoice No:# <? echo $invoiceId; ?></p>
<p>Invoice Date: <? echo $invoiceDate ;?> </p></td>
</tr>
</table></td>
</tr>
<tr>
<td height="125" colspan="5" valign="top"><p>Bill To:</p>
<p>Name:</p>
<p>Address:</p></td>
</tr>
<tr>
<td width="12%" align="center" height="40">Item Id</td>
<td width="28%" align="center">Item Disc</td>
<td width="9%" align="center">QTY</td>
<td width="40%" align="center">Price Per Unit</td>
<td width="11%" align="center">Total</td>
</tr>
<tr>
<td align="center" valign="middle">1</td>
<td align="center" valign="middle"><? echo $eventTitle . " ticket(s)"; ?></td>
<td align="center" valign="middle"><? echo $invoiceqty ; ?></td>
<td align="center" valign="middle"><? echo $invoicePPU ; ?></td>
<td align="center" valign="middle"><? echo $invoiceqty * $invoicePPU ; ?></td>
</tr>
</table>
for submitting behavior, i used Dreamweaver behavior panel. what's wrong here ?
I'm not sure about dreamweaver behaviour but as far as I can tell this will never work.
You are posting the data to a the "../../printInvoice.php" but when you request the popup page you are opening a new instance that hasn't received the post data.
You need to alter your javascript that pops the page up so that it posts the forms data when it performs the popup request.
I don't know which library you are using to create your popup but fancybox (Jquery plugin: http://fancybox.net) allows you to post data to the popup it creates.
If you could tell me what popup library you are using I might be able to help further.
you cant use php to show a popup you must use ajax, and javascript :
http://jquery.malsup.com/form/
$(document).ready(function() {
// bind 'myForm' and provide a simple callback function
$('#myForm').ajaxForm(function() {
//show your Popup
});
});
Have you tried to use $row['invoiceId']; instaed of $invoiceId in the popupwindow?
It seems to be the same file and therfore the $row[] data should be accessable!
If this doesn't works we propably need more code, especially of the php side.
^^ Overlooked something, we definitely need more code!
thanks, instead of all of this , i posted all the variables as url parameters such as :
<onsubmit="MM_openBrWindow('../../printInvoice.php?invoiceId=<? echo $row['invoiceId']; ?>&eventTitle=<? echo $row['name']; ?>','Invoice'
thanks for trying & your time everyone :)
Related
hello i have built a multi search form using php, basically this search form queries from a particular date to another, which i have gotten to work perfectly,
using this codes
search.html
<form class="form-horizontal" action="report_advanced.php" method="post" name="form1" id="form1">
<div class="control-group">
<label class="control-label" for="inputagent name"><span class="asasa">*</span> Advanced Search:</label>
<div class="controls">
<input type="text" name="from" value="" size="32" id="inputDate" placeholder="From" /><br /><br />
<input type="text" name="to" value="" size="32" id="inputDatess" placeholder="To" />
</div>
</div>
<p align="center">
<input type="submit" class="btn btn-mini btn-primary" value="Search" /></p>
</form>
and
report_advanced.php
mysql_select_db($database_kbl, $kbl);
$query_cert = sprintf("SELECT * FROM `transactions` WHERE `Start_Date` BETWEEN %s AND %s ",
GetSQLValueString($colname_cert, "text"),GetSQLValueString($colname2_cert, "text"));
$query_limit_cert = sprintf("%s LIMIT %d, %d", $query_cert, $startRow_cert, $maxRows_cert);
$cert = mysql_query($query_limit_cert, $kbl) or die(mysql_error());
$row_cert = mysql_fetch_assoc($cert);
<table width="60%" class="table table-bordered" id="table"></span>
<tr class="success">
<td style="color:#FFF" width="10%">Insured Name</td>
<td style="color:#FFF" width="10%">Telephone No</td>
<td style="color:#FFF" width="10%">Policy Number</td>
<td style="color:#FFF" width="10%">Car Make</td>
<td style="color:#FFF" width="10%">Model</td>
<td style="color:#FFF" width="10%">Registeration Number</td>
<td style="color:#FFF" width="10%">Amount</td>
<td style="color:#FFF" width="10%">Start Date</td>
<td style="color:#FFF" width="10%">Expiry Date</td>
</tr>
<?php do { ?>
<tr class="success" style="text-transform:capitalize;font-size:16px">
<td style="color:#FFF" width="10%"><?php echo $row_cert['Insured_Name']; ?></td>
<td style="color:#FFF" width="10%"><?php echo $row_cert['Telephone']; ?></td>
<td style="color:#FFF" width="10%"><?php echo $row_cert['Policy_Number']; ?></td>
<td style="color:#FFF" width="10%"><?php echo $row_cert['Make_Of_Car']; ?></td>
<td style="color:#FFF" width="10%"><?php echo $row_cert['Model']; ?></td>
<td style="color:#FFF" width="10%"><?php echo $row_cert['Registeration_Number']; ?></td>
<td style="color:#FFF" width="10%"><?php echo $row_cert['Premium']; ?></td>
<td style="color:#FFF" width="10%"><?php echo $row_cert['Start_Date']; ?> </td>
<td style="color:#FFF; font-size:14px" width="10%"><?php echo $row_cert['Expiry_Date']; ?></td>
<?php } while ($row_cert = mysql_fetch_assoc($cert)); ?> </table>
<?php } // Show if recordset not empty ?>
but now i want to implement this same type of functionality in a mobile app, using phonegap, and i intend to make ajax requests using the snippets i have posted and display in a div, since php cannot be run in phonegap,
but i dont know how o go about this, i have done some searchin online but havent seen what i am lookin 4.
most especially because i want to use the same code i have used in my web project for this app by makin an ajax request
Simply, what you do is just make another http ajax request from phonegap to the same endpoint to your server, get the response and reload it in the div.
i.e
$.get(url_to_endpoint, function(data){
// do reloading of your div
});
this is can be done using jquerymobile library easily or depends how you do http requests from your phonegap.
I am using a query to populate a list of messages by using a loop, here's my code:
<?php
$sql_i_msg_sent_waiting="SELECT t1.i_message_id,t2.username,t2.name,t2.propic,t2.age,t2.dob,t3.religion,t3.caste
FROM candidate_i_message as t1, candidate_register_table as t2, candidate_social_table as t3 WHERE t1.from_username='$_SESSION[logged_user]' AND t1.to_username=t2.username AND t2.username=t3.username AND t1.status='0'";
$result_i_msg_sent_waiting=mysql_query($sql_i_msg_sent_waiting,$con);
$count=mysql_num_rows($result_i_msg_sent_waiting);
echo $count;
?>
<div id="section_i_message_sent_waiting" style="width:650px; overflow:auto;">
<h2>Awaiting Sent Request</h2>
<?php
if(mysql_num_rows($result_i_msg_sent_waiting)==0)
{
?>
<div style="width:650px; border-bottom:1px solid #CCCCCC" align="center">
<table border='0' cellspacing='0' cellpadding='0' width='550px' align='center'>
<tr style='padding-botton:5px; border-bottom:1px solid #CCCCCC'>
<td width='50px'/>
<td><FONT COLOR=red FACE='Geneva, Arial' SIZE=2>
No Messages Found.</FONT></td>
<td width='50px'/></tr></table>
</div>
<?php
}
else
{
while($row_i_msg_sent_waiting=mysql_fetch_array($result_i_msg_sent_waiting))
{
?>
<div style="width:650px; border-bottom:1px solid #CCCCCC" align="center">
<table width="550px" cellpadding="0" cellspacing="0" border="2" align="center" style="vertical-align:middle">
<tr style='vertical-align:middle'>
<td style='vertical-align:middle' width="100px">
<form method='post' action='id.php' name='showid' id='showid'>
<input type='hidden' name='pro_username' id='pro_username'
value="<?php echo $row_i_msg_sent_waiting['username'];?>"/>
<input type='image' src='<?php echo $row_i_msg_sent_waiting['propic'];?> ' style="width:100px; vertical-align:middle"/>
</form>
</td>
<td style='vertical-align:middle;border-right:1px solid #CCCCCC;border-top:1px solid #CCCCCC' width="450px" >
<table width="450px" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="10px"/>
<td width="100px" align="left">Name</td>
<td width="10px">:</td>
<td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['name'];?>
</td>
<td width="10px">
<td width="100px" align="left">Age</td>
<td width="10px">:</td>
<td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['age'];?>
</td>
<td width="10px"/>
</tr>
<tr>
<td width="10px"/>
<td width="100px" align="left">Date Of Birth</td>
<td width="10px">:</td>
<td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['dob'];?>
</td>
<td width="10px">
<td width="100px" align="left">Religion</td>
<td width="10px">:</td>
<td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['religion'];?>
</td>
<td width="10px"/>
</tr>
<tr>
<td width="10px"/>
<td width="100px" align="left">Caste</td>
<td width="10px">:</td>
<td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['caste'];?>
</td>
<td width="10px">
<td width="100px" align="left">Religion</td>
<td width="10px">:</td>
<td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['religion'];?>
</td>
<td width="10px"/>
</tr>
<tr>
<td width="10px"/>
<td width="100px" align="left">Action</td>
<td width="10px">:</td>
<td width="100px" align="left">
<form method="post" name="cancel_request_form" id="cancel_request_form"
action="javascript:cancel_request(document.getElementById('cancel_request_form'));">
<input type="text" name="no_of_msg" id="no_of_msg" value="<?php echo $count;?>"/>
<input type="text" name="cancel_request[]" id="cancel_request[]"
value="<?php echo $row_i_msg_sent_waiting['i_message_id'];?>"/>
<input type="submit" name="cancel" id="cancel" class="button" style="width: 100px" value="Cancel Request"/>
</form>
</td>
<td width="10px">
<td width="100px" align="left"></td>
<td width="10px">:</td>
<td width="100px" align="left">
</td>
<td width="10px"/>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?php
}
}?>
</div>
the line
<input type="text" name="cancel_request[]" id="cancel_request[]"
value="<?php echo $row_i_msg_sent_waiting['i_message_id'];?>"/>
creates a array of input type text, and each input text contains corressponding message_id...since each input text is contained within a form, and since the form is within a loop, the form is also repeatative..when the submit button will be clicked corressponding to a particular form, the input type text[] within that form will fire the value to get accepted in the javascript i give below...
<script>
function cancel_request(obj) {
alert(document.getElementByName('cancel_request[]').value);
}
</script>
But the script is showing problem, it's not working at all. I don't know what's wrong. It's not displaying anything. There is message_id 1 and 2: one text type input[] contains value 1, another value 2.
When I click the submit button corresponding to value 1, the value of that text type input will be send to JavaScript and displayed. What's the problem with my script?
The function is getElementsByName - Elements in the plural. You then access it like an array.
Ive been working with meeplace and i've come into a problem regarding a syntax error in the code.
its in the advertising management pages:
echo "<option value='0'>AM</option>";
echo "<option value='12' ".$select.">PM</option>";
echo " </select></td>\r\n </tr>\r\n \r\n <tr>\r\n <td align=\"right\">Total Views Allowed:</td>\r\n <td><input type=\"text\" id=\"ad_total_views\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_views').val('');$('#ad_total_views').attr('disabled','disabled');}else{$('#ad_total_views').val('');$('#ad_total_views').removeAttr('disabled');$('#ad_total_views').focus()}\" />Unlimited</label></td>\r\n </tr>\r\n \r\n <tr>\r\n <td align=\"right\">Total Clicks Allowed:</td>\r\n <td><input type=\"text\" id=\"ad_total_clicks\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_clicks').val('');$('#ad_total_clicks').attr('disabled','disabled');}else{$('#ad_total_clicks').val('');$('#ad_total_clicks').removeAttr('disabled');$('#ad_total_clicks').focus()}\" />Unlimited</label></td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n <tr bgcolor=\"#FFFFFF\">\r\n <td class=\"td_th\" align=\"center\">Smarty Code (Developer)</td>\r\n <td>{\$ads->getAdCode(<span id=\"smartycode\">1</span>)}</td>\r\n </tr>\r\n <tr bgcolor=\"#FFFFFF\">\r\n <td class=\"td_th\" align=\"center\"> </td>\r\n <td><input type=\"button\" value=\"Create New Campaign\" onclick=\"new_ad()\" /></td>\r\n </tr>\r\n </TBODY></TABLE>\r\n<br />\r\n\r\n<TABLE cellSpacing=1 cellPadding=4 width=\"100%\" border=0>\r\n <TBODY>\r\n <TR class=\"td_title\">\r\n <TD colSpan=7>Ad Campaigns</TD></TR>\r\n <TR bgColor=#ffffff>\r\n \r\n <TD width=\"10%\" align=\"center\" class=\"td_th\"> </TD>\r\n <TD width=\"4%\" align=\"center\" class=\"td_th\">ID</TD>\r\n <TD width=\"29%\" align=\"center\" class=\"td_th\">Campaign Name</TD>\r\n <TD width=\"12%\" align=\"center\" class=\"td_th\">Start Date</TD>\r\n <TD width=\"11%\" align=\"center\" class=\"td_th\">End Date</TD>\r\n <TD width=\"17%\" align=\"center\" class=\"td_th\">Viewed / Views Allowed</TD>\r\n <TD width=\"17%\" align=\"center\" class=\"td_th\">Clicked / Clicks Allowed</TD>\r\n </TR>\r\n ";
i'm not too sure whats going wrong, the error is on the third line of code above.
Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in /mgt/body/ad_list.php on line 185
If anyone else has had this problem or knows a simple answer to cure this it would be brilliant. I've tried a few things like making it more than one line but no luck! :s
Update
Ive managed to narrow the problem down to this bit:
<label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_views').val('');$('#ad_total_views').attr('disabled','disabled');}else{$('#ad_total_views').val('');$('#ad_total_views').removeAttr('disabled');$('#ad_total_views').focus()}\" />Unlimited</label></td>\r\n
This is one crazy echo have seen in a long while .. I would advice you to use Heredoc
Example
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
echo $str ;
Back to your Script
<?php
$select ="test";
echo "<option value='0'>AM</option>";
echo "<option value='12' " . $select . ">PM</option>";
echo <<<DATA
</select>
</td>
</tr>
<tr>
<td align="right">Total Views Allowed:</td>
<td><input type="text" id="ad_total_views" style=""
"width:50px;" value="" disabled="disabled" /> <label><input
type="checkbox" checked="checked" onclick="if(this.checked==true){\$ ('#ad_total_views') . val ( '' );$
('#ad_total_views') . attr ( 'disabled', 'disabled' );
}else{\$('#ad_total_views').val('');$('#ad_total_views').removeAttr('disabled');\$('#ad_total_views').focus()}" />Unlimited</label></td>
</tr>
<tr>
<td align="right">Total Clicks Allowed:</td>
<td><input type="text" id="ad_total_clicks" style=""
"width:50px;" value="" disabled="disabled" /> <label><input
type="checkbox" checked="checked" onclick="if(this.checked==true){\$( '#ad_total_clicks').val('');$('#ad_total_clicks').attr('disabled','disabled');
}else{\$('#ad_total_clicks').val('');\$('#ad_total_clicks').removeAttr('disabled');\$('#ad_total_clicks').focus()}" />Unlimited</label></td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="td_th" align="center">Smarty Code (Developer)</td>
<td>{\$ads->getAdCode(<span id="smartycode">1</span>)}
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="td_th" align="center"> </td>
<td><input type="button" value="Create New Campaign" onclick="new_ad()" /></td>
</tr>
</TBODY>
</TABLE>
<br />
<TABLE cellSpacing=1 cellPadding=4 width="100%" border=0>
<TBODY>
<TR class="td_title">
<TD colSpan=7>Ad Campaigns</TD>
</TR>
<TR bgColor=#ffffff>
<TD width="10%" align="center" class="td_th"> </TD>
<TD width="4%" align="center" class="td_th">ID</TD>
<TD width="29%" align="center" class="td_th">Campaign Name</TD>
<TD width="12%" align="center" class="td_th">Start Date</TD>
<TD width="11%" align="center" class="td_th">End Date</TD>
<TD width="17%" align="center" class="td_th">Viewed / Views
Allowed</TD>
<TD width="17%" align="center" class="td_th">Clicked / Clicks
Allowed</TD>
</TR>
DATA;
?>
Demo : http://codepad.viper-7.com/3Scnp4
Try this instead:
echo ' </select></td>'."\r\n".' </tr>'."\r\n".' '."\r\n".' <tr>'."\r\n".' <td align="right">Total Views Allowed:</td>'."\r\n".' <td><input type="text" id="ad_total_views" style="width:50px;" value="" disabled="disabled" /> <label><input type="checkbox" checked="checked" onclick="if(this.checked==true){$(\'#ad_total_views\').val(\'\');$(\'#ad_total_views\').attr(\'disabled\',\'disabled\');}else{$(\'#ad_total_views\').val(\'\');$(\'#ad_total_views\').removeAttr(\'disabled\');$(\'#ad_total_views\').focus()}" />Unlimited</label></td>'."\r\n".' </tr>'."\r\n".' '."\r\n".' <tr>'."\r\n".' <td align="right">Total Clicks Allowed:</td>'."\r\n".' <td><input type="text" id="ad_total_clicks" style="width:50px;" value="" disabled="disabled" /> <label><input type="checkbox" checked="checked" onclick="if(this.checked==true){$(\'#ad_total_clicks\').val(\'\');$(\'#ad_total_clicks\').attr(\'disabled\',\'disabled\');}else{$(\'#ad_total_clicks\').val(\'\');$(\'#ad_total_clicks\').removeAttr(\'disabled\');$(\'#ad_total_clicks\').focus()}" />Unlimited</label></td>'."\r\n".' </tr>'."\r\n".' </table></td>'."\r\n".' </tr>'."\r\n".' <tr bgcolor="#FFFFFF">'."\r\n".' <td class="td_th" align="center">Smarty Code (Developer)</td>'."\r\n".' <td>{\$ads->getAdCode(<span id="smartycode">1</span>)}</td>'."\r\n".' </tr>'."\r\n".' <tr bgcolor="#FFFFFF">'."\r\n".' <td class="td_th" align="center"> </td>'."\r\n".' <td><input type="button" value="Create New Campaign" onclick="new_ad()" /></td>'."\r\n".' </tr>'."\r\n".' </TBODY></TABLE>'."\r\n".'<br />'."\r\n".''."\r\n".'<TABLE cellSpacing=1 cellPadding=4 width="100%" border=0>'."\r\n".' <TBODY>'."\r\n".' <TR class="td_title">'."\r\n".' <TD colSpan=7>Ad Campaigns</TD></TR>'."\r\n".' <TR bgColor=#ffffff>'."\r\n".' '."\r\n".' <TD width="10%" align="center" class="td_th"> </TD>'."\r\n".' <TD width="4%" align="center" class="td_th">ID</TD>'."\r\n".' <TD width="29%" align="center" class="td_th">Campaign Name</TD>'."\r\n".' <TD width="12%" align="center" class="td_th">Start Date</TD>'."\r\n".' <TD width="11%" align="center" class="td_th">End Date</TD>'."\r\n".' <TD width="17%" align="center" class="td_th">Viewed / Views Allowed</TD>'."\r\n".' <TD width="17%" align="center" class="td_th">Clicked / Clicks Allowed</TD>'."\r\n".' </TR>'."\r\n".' ';
PHP possibly gets confused because of the $ inside the string as it's a double quoted string and $ are parsed as variable starts inside that string.
i have a form that extract data from mysql table into a form, each row has a menu to choose a value from and i want to update mysql with each value choosen for each row when the 'Apply To All' button is clicked but doesnt work at all.,here is my code.
<td><form id="main" name="main" method="post" action="setProjectStatus.php" onsubmit="return validateMain();">
<table width="100%" cellspacing="1" cellpadding="1">
<tr>
<td width="35%" rowspan="3"><img src="../img/project.jpg" alt="Comp Sci Stud" width="325" height="199" border="2" /></td>
<td width="65%" height="42" colspan="2"><table width="94%" cellpadding="1" cellspacing="1" class="main_table">
<tr class="table_title">
<td width="100%" class="table_title">Set Project Status. </td>
</tr>
<tr>
<td height="26"> </td>
</tr>
<tr>
<td height="26"><table width="100%" cellspacing="1" cellpadding="1">
<tr class="table_head">
<td width="2%" height="35"><div align="center"></div></td>
<td width="26%" height="35"><div align="center">Student Name</div></td>
<td colspan="2"><div align="center">Project</div></td>
<td width="19%"><div align="center">Status</div></td>
</tr>
<?php
session_start();
$username = $_SESSION['username'];
require_once("mysqlConnect.php");
//
$sql="SELECT * FROM spms_Student";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
echo "There are $count projects to be undertaken.";
while($rows=mysql_fetch_array($result)){
//
$query = "SELECT name FROM spms_systemUser WHERE userId = '".$rows[0]."'";
$result1 = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result1);
$name = $row[0];
?>
<tr>
<td height="25" align="center"> </td>
<td align="center"><?php echo $name; ?></td>
<td colspan="2" align="center"><?php echo $rows[1]; ?></td>
<td align="center"><label>
<select name="select" class="form_field_100px_select">
<option value="Pending" selected="selected">Pending</option>
<option value="Approved">Approved</option>
<option value="Disapproved">Disapproved</option>
</select>
</label></td>
</tr>
<?php
}
?>
<tr class="pager_bg">
<td height="35"> </td>
<td> </td>
<td width="37%" align="right"><input name="done" type="button" id="done" value="Done" onclick="window.location='../coordinatorMenu.html'" /></td>
<td width="16%"><label>
<input name="approveAll" type="submit" id="approveAll" value="Approve All" />
</label></td>
<td><input name="apply" type="submit" id="apply" value="Apply To All" /></td>
</tr>
<?php
mysql_close();
?>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><label></label> <label></label></td>
</tr>
</table>
</form></td>
You're trying to reuse your MySQL connection while still holding on to the resultset from the first query. You need to create a second connection for the inner loop queries. Even better would probably be to rewrite your query using a join, but I can't say for sure without knowing your schema.
I m working on module in which i have to make pdf from php page. I m Using tcpdf for that but m facing one problem that file contain some mysql queries and php coding which is not executed by pdf page.
$prn_no = $_POST['prn_no'];
$current_sem = $_POST['current_sem'];
$qr_fetch_sem_res_id = mysql_query("SELECT * FROM table1 WHERE ((prn='$prn_no') AND (semisterName='$current_sem'))")or die(mysql_error());
$qr_fetch_sem_result_ans = mysql_fetch_array($qr_fetch_sem_res_id);
<tr>
<td colspan="11" align="left" valign="middle">Programme Name: <?php echo $qr_fetch_sem_result_ans['programme_name'];?></td>
</tr>
<tr>
<td colspan="11" align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="27%">Seat No.: <?php echo $qr_fetch_sem_result_ans['seatNo'];?></td>
<td width="3%"> </td>
<td width="22%">PR No. : <?php echo $qr_fetch_sem_result_ans['prn'];?></td>
<td width="2%"> </td>
<td width="17%">Semester : <?php echo $qr_fetch_sem_result_ans['semisterName'];?></td>
<td width="1%"> </td>
<td width="25%">Month / Year Of Exam : <?php echo $qr_fetch_sem_result_ans['month_year_of_exam'];?> </td>
<td width="3%"> </td>
</tr>
<tr>
<td colspan="3">Name: <?php echo $qr_fetch_sem_result_ans['student_name'];?></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="7">College / Institute: <?php echo $qr_fetch_sem_result_ans['institute_name'];?></td>
<td> </td>
</tr>
</table></td>
</tr>
I'm going to go out on a limb here and suggest that you run your queries fist and then build your pdf file. If you run the queries after you build the pdf then of course it will not have access to your data. If that doesn't help then I must not understand what you're asking.