Css works on dreamweaver but not on chrome - javascript

i'm trying to make a table with html and php code which displays dynamically data, above that i use css for this table, and when i use live mode on dreamweaver it displays perfectly the table with css but empty, but not on chrome or whatever is the web browser, and actually i try to integrate the whole html and css in a ready template.
for the information this is the html code that i used:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="background">Placez ici le contenu de class "background"
<center>
<h1>VOS SOUMISSIONS</h1>
<table width="1327" height="128" border="2" cellpadding="20" cellspacing="10">
<tr>
<th width="208">SENDER</th>
<th width="258">TYPE</th>
<th width="258">TITRE</th>
<th width="290">AUTEUR</th>
<th width="289">ABSTRACT</th>
<th width="289">KEYWORDS</th>
<th width="289">DATE</th>
<th width="289">FICHIER</th>
</tr>
<?php
//On recupere les identifiants, les pseudos et les emails des utilisateurs
$result = mysql_query("SELECT * FROM manusrit where id='".$_SESSION["id"]."'");
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td class="left"><?php echo $row['sender']; ?></td>
<td class="left"><?php echo $row['type']; ?></td>
<td class="left"><?php echo htmlentities($row['titre'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo htmlentities($row['auteur'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo $row['abstract']; ?></td>
<td class="left"><?php echo $row['keywords']; ?></td>
<td class="left"><?php echo $row['date']; ?></td>
<td class="left"><?php echo $row['file']; ?></td>
<td class="left"><form action="/Application/soumissions/<?php echo $row['file']; ?>" method="post">
<input type="submit" value="Download" />
</form></td>
<?php
}
?>
</tr>
</table>
<p> </p><h2><strong>LES AUTRES SOUMISSIONS</strong></h2>';
<table width="1346" height="128" border="2" cellpadding="20" cellspacing="10">
<tr>
<th width="208">SENDER</th>
<th width="258">TYPE</th>
<th width="258">TITRE</th>
<th width="290">AUTEUR</th>
<th width="289">ABSTRACT</th>
<th width="289">KEYWORDS</th>
<th width="289">DATE</th>
<th width="289">FICHIER</th>
<th width="41">ETAT</th>
<th width="84">DECISION</th>
<th width="101">RAPPORT</th>
<th width="120">TELECHARGER</th>
</tr>
<?php
//On recupere les identifiants, les pseudos et les emails des utilisateurs
$req = mysql_query("SELECT * FROM manusrit where id2='1' AND id3='".$_SESSION["id3"]."'");
while (($rows=mysql_fetch_array($req)))
{
?>
<tr>
<td class="left"><?php echo $rows['sender']; ?></td>
<td class="left"><?php echo $rows['type']; ?></a></td>
<td class="left"><?php echo htmlentities($rows['titre'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo htmlentities($rows['auteur'], ENT_QUOTES, 'UTF-8'); ?></a></td>
<td class="left"><?php echo $rows['abstract']; ?></td>
<td class="left"><?php echo $rows['keywords']; ?></td>
<td class="left"><?php echo $rows['date']; ?></td>
<td class="left"><?php echo $rows['file']; ?></td>
<td class="left"><?php echo $rows['etat']; ?></td>
<td class="left"><?php echo $rows['decision']; ?></td>
<td class="left"><form action="/Application/rapport/<?php echo $row['rapport']; ?>" method="post">
<input type="submit" value="Voir le rapport" />
</form></td>
<td class="left"><form action="/Application/soumissions/<?php echo $rows['file']; ?>" method="post">
<input type="submit" value="Download" />
</form></td>
<?php
}
?>
</tr>
</table>
</center>
</div>
</body>
</html>
And this is the css code:
.background {
font-family: "Courier New", Courier, monospace;
font-size: 12px;
font-style: italic;
color: #FFF;
background-color: #666;
background-repeat: repeat;
width: 1327px;
}
Thnx for your help!

Presuming that the html provided is your full document, you don't have the css file included. You will need to add
<link rel="stylesheet" type="text/css" href="style.css">
before the end of the head tag. Also the href attribute must be whatever your css file is actually named.

Related

How to populate the html table when date is set

I'm trying to make a table which will get populated with data according to the search date. My search is working but the problem I'm having is how to get all that data into HTML table.
Below is my code which kept trying different ways.
HTML:
<?php
session_start();
include_once("../iConnect/handShake.php");
include_once ("../Functions/userCheck.php");
//TODO write the SQL to accept and retrieve the data
if (isset($_REQUEST["date"])){
$getJobs = "SELECT * FROM usertimetrack WHERE jDate = :jDate";
$getJobsQuery = $dbConnect -> prepare($getJobs);
$getJobsQuery -> bindParam(':jDate', $_REQUEST["date"]);
$getJobsQuery -> execute();
}
//$getJobs = "SELECT * FROM usertimetrack ORDER BY utId ASC";
//$getJobsQuery = $dbConnect -> query($getJobs);
?>
<html>
<head>
<!-- Style Sheets -->
<link rel="stylesheet" type="text/css" href="../../CSS/main.css">
<link rel="stylesheet" type="text/css" href="../../CSS/jquery-ui.min.css">
<!-- Java Scripts -->
<script language="JavaScript" type="text/javascript" src="../../jScripts/jquery-3.2.0.min.js"></script>
<script language="JavaScript" type="text/javascript" src="../../jScripts/jquery-ui.min.js"></script>
<script language="JavaScript" type="text/javascript" src="../../jScripts/editTimeEntryFunctions.js"></script>
</head>
<body>
<div id="divCenter" class="box">
<div class="logo">
<img src="../../images/logo.png" width="142" height="33">
</div>
<div id="mainDiv">
<div id="navi"></div>
<div id="infoi"></div>
<label for="dPicker">Date:</label>
<input type="text" id="dPicker" style="margin-left: .5%;" size="10">
<input type="button" class="getData" value="Submit">
<table id="hor-minimalist-b">
<div id="bgDimmer"></div>
<div id="divContent"></div>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">User Name</th>
<th scope="col">Category</th>
<th scope="col">Client</th>
<th scope="col">Start Time</th>
<th scope="col">End Time</th>
<th scope="col">Time Spent</th>
<th scope="col">Volume</th>
<th scope="col">Prod. Lines</th>
<th scope="col">Remarks</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php while ($getJobsRow = $getJobsQuery -> fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<td><?php echo $getJobsRow["utId"]; ?></td>
<td><?php echo $getJobsRow["usrId"]; ?></td>
<td><?php echo $getJobsRow["Category"]; ?></td>
<td><?php echo $getJobsRow["Client"]; ?></td>
<td><?php echo $getJobsRow["startTime"]; ?></td>
<td><?php echo $getJobsRow["endTime"]; ?></td>
<td><?php echo $getJobsRow["timeSpent"]; ?></td>
<td><?php echo $getJobsRow["Volume"]; ?></td>
<td><?php echo $getJobsRow["noOfProductLines"]; ?></td>
<td><?php echo $getJobsRow["Remarks"]; ?></td>
<td><input type="button" class="uEdit" value="Edit" data-uid="<?php echo $getJobsRow["utId"]; ?>" /></td>
<td><input type="button" class="uDel" value="Delete" data-uid="<?php echo $getJobsRow["utId"]; ?>" /></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<div id="msg"></div>
</body>
</html>
I have tried to use the below JavaScript submit the data to the same page it does work according to the browser console but it doesn't get loaded into the visible page.
JavaScript:
function getData(){
var date = document.getElementById("dPicker").value;
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","../functions/editTimeEntry.php?date="+date,true);
xmlhttp.send();
}
When the above code didn't work I have tried to do it using JQuery which was a dead end.
EDIT: Let me make this more simple is there any way to archive the below dirty PHP method using JavaScript or any other.
Script:
<div align="right" style="background-color:#CCC" class="noprint">
<input type="text" id="loomDate" name="loomDate" value="---Select Loom Date---" />
<script type="text/javascript">
$(function(){
$('*[name=loomDate]').appendDtpicker(
{
'dateFormat' : 'DD/MM/YYYY',
'dateOnly': true,
'closeOnSelected': true,
'autodateOnStart': false
}
);
});
</script>
<input type="button" id="Search" name="Search" value="Search" onclick="this.form.submit()" />
<input type="button" id="Print" name="Print" VALUE="Print" onclick="window.print()" />
</div>
Can someone please guide me down the path of light.
UPDATE:
Someone did show me the light so I'm going to share it with you guys here.
Finally found how to get this done thanks to PHP freshers so below is the code I'm using currently need to be refined but still, it has the basic idea.
HTML: (Main Page)
<?php
session_start();
include_once ("../Functions/userCheck.php");
?>
<html>
<head>
<!-- Style Sheets -->
<link rel="stylesheet" type="text/css" href="../../CSS/main.css">
<link rel="stylesheet" type="text/css" href="../../CSS/jquery-ui.min.css">
<!-- Java Scripts -->
<script language="JavaScript" type="text/javascript" src="../../jScripts/jquery-3.2.0.min.js"></script>
<script language="JavaScript" type="text/javascript" src="../../jScripts/jquery-ui.min.js"></script>
<script language="JavaScript" type="text/javascript" src="../../jScripts/editTimeEntryFunctions.js"></script>
</head>
<body>
<div id="divCenter" class="box">
<div class="logo">
<img src="../../images/logo.png" width="142" height="33">
</div>
<div id="mainDiv">
<label for="dPicker">Date:</label>
<input type="text" id="dPicker" style="margin-left: .5%;" size="10">
<input type="button" class="getData" value="Submit" onclick="getData();">
</div>
<div id="table"></div>
</div>
<div id="msg"></div>
</body>
</html>
HTML / PHP: (Display Page)
<?php
session_start();
include_once("../iConnect/handShake.php");
include_once ("../Functions/userCheck.php");
//TODO write the SQL to accept and retrieve the data
if (isset($_REQUEST["date"])){
$getJobs = "SELECT * FROM usertimetrack WHERE jDate = :jDate";
$getJobsQuery = $dbConnect -> prepare($getJobs);
$getJobsQuery -> bindParam(':jDate', $_REQUEST["date"]);
$getJobsQuery -> execute();
}
//$getJobs = "SELECT * FROM usertimetrack ORDER BY utId ASC";
//$getJobsQuery = $dbConnect -> query($getJobs);
?>
<html>
<head>
<!-- Style Sheets -->
<link rel="stylesheet" type="text/css" href="../../CSS/main.css">
<link rel="stylesheet" type="text/css" href="../../CSS/jquery-ui.min.css">
<!-- Java Scripts -->
<script language="JavaScript" type="text/javascript" src="../../jScripts/jquery-3.2.0.min.js"></script>
<script language="JavaScript" type="text/javascript" src="../../jScripts/jquery-ui.min.js"></script>
<script language="JavaScript" type="text/javascript" src="../../jScripts/editTimeEntryFunctions.js"></script>
</head>
<body>
<div id="mainDiv">
<div id="navi"></div>
<div id="infoi"></div>
<table id="hor-minimalist-b">
<div id="bgDimmer"></div>
<div id="divContent"></div>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">User Name</th>
<th scope="col">Category</th>
<th scope="col">Client</th>
<th scope="col">Start Time</th>
<th scope="col">End Time</th>
<th scope="col">Time Spent</th>
<th scope="col">Volume</th>
<th scope="col">Prod. Lines</th>
<th scope="col">Remarks</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php while ($getJobsRow = $getJobsQuery -> fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<td><?php echo $getJobsRow["utId"]; ?></td>
<td><?php echo $getJobsRow["usrId"]; ?></td>
<td><?php echo $getJobsRow["Category"]; ?></td>
<td><?php echo $getJobsRow["Client"]; ?></td>
<td><?php echo $getJobsRow["startTime"]; ?></td>
<td><?php echo $getJobsRow["endTime"]; ?></td>
<td><?php echo $getJobsRow["timeSpent"]; ?></td>
<td><?php echo $getJobsRow["Volume"]; ?></td>
<td><?php echo $getJobsRow["noOfProductLines"]; ?></td>
<td><?php echo $getJobsRow["Remarks"]; ?></td>
<td><input type="button" class="uEdit" value="Edit" data-uid="<?php echo $getJobsRow["utId"]; ?>" /></td>
<td><input type="button" class="uDel" value="Delete" data-uid="<?php echo $getJobsRow["utId"]; ?>" /></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
JavaScript:
$(function () {
$('#dPicker').datepicker({
dateFormat: 'dd-mm-yy',
showAnim: 'slide'
});
});
function getData(){
var date = document.getElementById("dPicker").value;
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("table").innerHTML = this.responseText;
}
};
xmlhttp.open("POST","../functions/timeEditResult.php?date="+date,true);
xmlhttp.send();}
If anyone wants to know I'm using Jquery UI for my date picker it's a very good Jquery library.
And hope this helps someone in future.

Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xampp\htdocs\3s_shop\admin\pembelian_data.php on line 6 error paging: [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 6 years ago.
This is my form distributor data code.
If I click the button before it would be an error
Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xampp\htdocs\3s_shop\admin\pembelian_data.php on line 6
error paging:
What's wrong in the code?
<?php
# UNTUK PAGING (PEMBAGIAN HALAMAN)
$baris = 50;
$hal = isset($_GET['hal']) ? $_GET['hal'] : 0;
$pageSql = "SELECT * FROM pembelian";
$pageQry = mysql_query($pageSql, $koneksidb) or die ("error paging: ".mysql_error());
$jml = mysql_num_rows($pageQry);
$maksData = ceil($jml/$baris);
?>
<table width="800" border="0" cellpadding="2" cellspacing="1" class="table-border">
<tr>
<td colspan="2" align="right"><h1><b>DATA PEMBELIAN</b></h1></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="right"><img src="../images/btn_add_data.png" height="30" border="0" /></td>
</tr>
<tr>
<td colspan="2"><table class="table-list" width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<th width="35" align="center" bgcolor="#CCCCCC">No</th>
<th width="250" bgcolor="#CCCCCC">Nama Reseller</th>
<th width="100" bgcolor="#CCCCCC">Tanggal Pembelian</th>
<th width="250" bgcolor="#CCCCCC">Nama Produk</th>
<th width="150" bgcolor="#CCCCCC">Harga Produk </th>
<th width="50" bgcolor="#CCCCCC">Jumlah Produk </th>
<th width="150" bgcolor="#CCCCCC">Total Harga </th>
<td colspan="2" align="center" bgcolor="#CCCCCC"><strong>Tools</strong></td>
</tr>
<?php
$mySql = "SELECT * FROM pembelian ORDER BY nm_reseller, tgl_pembelian, nama_barang, hrg_barang, qty ASC LIMIT $hal, $baris";
$myQry = mysql_query($mySql, $koneksidb) or die ("Query salah : ".mysql_error());
$nomor = $hal;
while ($myData = mysql_fetch_array($myQry)) {
$nomor++;
$Kode = $myData['kd_pembelian'];
// Warna baris data
if($nomor%2==1) { $warna=""; } else {$warna="#F5F5F5";}
?>
<tr bgcolor="<?php echo $warna; ?>">
<td align="center"><?php echo $nomor; ?></td>
<td><?php echo $myData['nm_reseller']; ?></td>
<td><?php echo $myData['tgl_pembelian']; ?></td>
<td><?php echo $myData['nama_barang']; ?></td>
<td><?php echo $myData['hrg_barang']; ?></td>
<td><?php echo $myData['qty']; ?></td>
<td width="44" align="center">Edit</td>
<td width="44" align="center">Hapus</td>
</tr>
<?php } ?>
</table></td>
</tr>
<tr class="selKecil">
<td><b>Jumlah Data :</b> <?php echo $jml; ?> </td>
<td align="right"><b>Halaman ke :</b>
<?php
for ($h = 1; $h <= $maksData; $h++) {
$list[$h] = $baris * $h - $baris;
echo " <a href='?open=Pembelian-Data&hal=$list[$h]'>$h</a> ";
}
?> </td>
</tr>
</table>
I think you are not establishing connection to your database. The second input should be that connection variable. like this:
$link = mysql_connect("localhost","root","");
$koneksidb = mysql_select_db('databaseName', $link);
$pageSql = "SELECT * FROM pembelian";
$pageQry = mysql_query($pageSql, $koneksidb) or die ("error paging: ".mysql_error());

javascript unkown error on css code line

I have this html table:
<center><input type="button" value="Print last visit report" id="printpagebutton" onclick="printData()"/>
<input type="button" value="Print all reports" id="printpagebutton2" onclick="printData1()"/>
</center></BR>
<center></center>
<div class=WordSection1 id="mydiv1">
<?php while($rows = mysqli_fetch_array($result)) { $data2 =$rows['echo_files'];
$dataFile2 = str_replace('/', '\\', $data2); ?>
<div id="mydiv">
<form action="/clinic form/update/update.php" id="Form2" method="post">
<table border="1" align="center" id="table">
<tr align="center">
<th colspan="3" bgcolor="#7a7878">DR. Omar GHNEIM - Patient Medical History</th>
</tr>
<tr align="center">
<th colspan="3"><?php echo 'Medical History of '.$rows['name']?></th>
</tr>
<tr>
<th>Medicaments</th>
<th>Illness</th>
<th>Echo Results</th>
</tr>
<tr>
<?php if(!empty($rows['remarcs']) && trim($rows['remarcs'])!=''):?>
<td width="250px"><?php echo $rows['remarcs'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
<?php if(!empty($rows['illness']) && trim($rows['illness'])!=''):?>
<td width="250px"><?php echo $rows['illness'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
<?php if(!empty($rows['echo']) && trim($rows['echo'])!=''):?>
<td width="250px"><?php echo $rows['echo'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
</tr>
<tr>
<th>Clinic Test Result</th>
<th>Habbits</th>
<th>Allergy</th>
</tr>
<tr>
<?php if(!empty($rows['test_res']) && trim($rows['test_res'])!=''):?>
<td width="250px"><?php echo $rows['test_res'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
<?php if(!empty($rows['habbits']) && trim($rows['habbits'])!=''):?>
<td width="250px"><?php echo $rows['habbits'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
<?php if(!empty($rows['allergy']) && trim($rows['allergy'])!=''):?>
<td width="250px"><?php echo $rows['allergy'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
</tr>
<tr>
<th>Occupation</th>
<th>PMHx</th>
<th>PSHx</th>
</tr>
<tr>
<?php if(!empty($rows['occup']) && trim($rows['occup'])!=''):?>
<td width="250px"><?php echo $rows['occup'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
<?php if(!empty($rows['pmhx']) && trim($rows['pmhx'])!=''):?>
<td width="250px"><?php echo $rows['pmhx'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
<?php if(!empty($rows['pshx']) && trim($rows['pshx'])!=''):?>
<td width="250px"><?php echo $rows['pshx'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
</tr>
<tr>
<th colspan="3">Echo Files</th>
</tr>
<tr>
<?php if(!empty($data2) && trim($data2)!=''):?>
<td colspan="3" align="center"><center><a href='download_PopUp.php?data=<?php echo $dataFile2; ?>'>Echo Test files exist</a></center></td>
<?php else: ?>
<td colspan="3" align="center"><center>No echo files</center></td>
<?php endif;?>
</tr>
<tr>
<th>P.E</th>
<?php if(!empty($rows['pe']) && trim($rows['pe'])!=''):?>
<td width="250px"><?php echo $rows['pe'] ?></td>
<?php else: ?>
<td width="250px" align="center">Not Available</td>
<?php endif; ?>
<th rowspan="4" align="left">Signature</th>
</tr>
<tr>
<th>Date</th><td><?php echo $rows['date'] ?></td>
</tr>
<tr>
<th>Address of Patient</th><td><?php echo $rows['address'] ?></td>
</tr>
<tr>
<th>Phone Number of patient</th><td><?php echo $rows['phone_num'] ?></td>
</tr>
</table>
And this javascript file to print a div in a page with a css, but dreamweaver software give an error:
function printData()
{
var divToPrint=document.getElementById("mydiv");
newWin= window.open("");
newWin.document.write(divToPrint.outerHTML);
var css =`table, td, th {
border: 1px solid black;
text-align:justify;
}
th {
background-color: #7a7878;
text-align:center
}`;
var div = $("<div />", {
html: '­<style>' + css + '</style>'
}).appendTo( newWin.document.body);
newWin.print();
newWin.close();
}
$('button').on('click',function(){
printData();
});
But in the browser when I hit F12, nothing is given as error, and the css style won't work.
Template strings are not supported in IE. That's probably why dreamweaver throws an error on that line.
Either escape newlines:
var myString = 'some \n\
multiline \n\
string';
Or concatenate lines:
var myString = 'some \n' +
'multiline \n' +
'string';
A multiline string in javascript can be made like that in most modern browsers but does not work in IE and older browsers.
You should change
var css =`table, td, th {
border: 1px solid black;
text-align:justify;
}
th {
background-color: #7a7878;
text-align:center
}`;
to:
var css = "table, td, th { \n\
border: 1px solid black; \n\
text-align:justify; \n\
} \n\
\n\
th { \n\
background-color: #7a7878; \n\
text-align:center \n\
}";
It is even better to make it:
var css = "table, td, th { \n"+
" border: 1px solid black; \n"+
" txt-align:justify; \n"+
"} \n"+
"th { \n"+
" background-color: #7a7878; \n"+
" text-align:center; \n"+
"}";
The reason that your css is not displayed is:
Once IE has processed all the styles loaded with the page, the only reliable way to add another stylesheet is with document.createStyleSheet(url)
See the MSDN article on createStyleSheet for a few more details.
edit
So in your case, you can add the above css code to table.css, upload it to your server. And at the moment you want to add the style, you use
document.createStyleSheet('http://yourserver.com/table.css');

how can i make print button that will print a report?

I'm doing on a project but my problem is that i don't have any idea on how to make a print button to print my report..the report is in a table..can somebody please help me with this one?my question is how can i add a button for printing?
here is my code for the viewing of specific record
<?php
include_once 'dbconfig.php';
$username = isset($_GET['username']) ? $_GET['username'] : '';
$password = isset($_GET['password']) ? $_GET['password'] : '';
$province = isset($_GET['province']) ? $_GET['province'] : '';
if(isset($_GET['user_id']))
{
$user_id = $_GET['user_id'];
extract($crud->getID($user_id));
}
?>
<body>
<div id="Survey-view">
<div id="header">
</div>
<p><strong>INFORMATION</strong></p>
<hr />
<div id="main-frame">
<table id="information-content" cellspacing="0">
<thead>
<tr>
<th>Username</th>
<th>Password</th>
<th>Province</th>
</tr>
<tbody>
<tr>
<td><?php echo $username; ?></td>
<td><?php echo $password; ?></td>
<td><?php echo $province; ?></td>
</tr>
</tbody>
</thead>
</table>
</div>
<br />
<br />
<p><strong>ASP</strong></p>
<hr />
<div id="asp">
<table id="asp-content" cellspacing="0">
<thead>
<tr>
<th>Date Survey</th>
<th>Date Submitted</th>
<th>Date Approved</th>
<th>Date Recv'd by Region</th>
<th>Date Recv'd by DARPO</th>
</tr>
<tbody>
<tr>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
</tr>
</tbody>
</thead>
</table>
</div><!-- End of asp-->
<br />
<br />
<p><strong>DENR/DARPO</strong></p>
<hr />
<div id="denrdarpo">
<table id="denrdarpo-content" cellspacing="0">
<thead>
<tr>
<th>Date Survey</th>
<th>Date Submitted</th>
<th>Date Approved</th>
<th>Date Recv'd by Region</th>
<th>Date Recv'd by DARPO</th>
</tr>
<tbody>
<tr>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
<td><?php echo $username; ?></td>
</tr>
</tbody>
</thead>
</table>
</div><!--End of denrdarpo-->
<br />
<br />
<p><strong>OTHERS</strong></p>
<hr />
<div id="others">
<table id="others-content" cellspacing="0">
<tr>
<td>Project Number</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
<td>Module Number</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
</tr>
<tr>
<td>Fund Year</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
<td>LAD Target</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
</tr>
<tr>
<td>Land Category</td>
<td><select disabled>
<option><?php echo $username; ?></option>
</select></td>
<td>LAnd Type</td>
<td><select disabled>
<option><?php echo $username; ?></option>
</select></td>
</tr>
<tr>
<td>Date Reported</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
<td>Date Suspended</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
</tr>
<tr>
<td>Date Completed</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
<td>Number of Lots</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
</tr>
<tr>
<td>Station</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
<td>Contractor</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
</tr>
<tr>
<td>Agency</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
<td>Cert 40</td>
<td><input type="text" value="<?php echo $username; ?>" disabled></td>
</tr>
</table>
</div>
</div>
</body>
Every time I need to do this I go to my old Gmail account, print a page and then view the source code cus I'm too lazy to remember the functions..
This is how Google does it.
<script type="text/javascript">// <![CDATA[
document.body.onload=function(){document.body.offsetHeight;window.print()};
// ]]></script>
You could just as easily attach it to a button instead of doing it on load.
<button onclick="document.body.offsetHeight;window.print();">Print</button>
Here's a working example.
And this one will remove the button from the printed page:
<button onclick="this.style.display='none';document.body.offsetHeight;window.print();this.style.display='inline';">Print</button>
And another example.
<html>
<head>
<script type="text/javascript">
function openWin()
{
var myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.document.close();
myWindow.focus();
myWindow.print();
myWindow.close();
}
</script>
</head>
<body>
<input type="button" value="Open window" onclick="openWin()" />
</body>
</html>

retrieving radio button value if name is from database(lopped)

i am making a simple quiz
the code below is my code for echoing the questions in the database
i used while loop to output the values in the database
i used the q_question for the name of each radio button, because if i put (sample : name="question" which is fixed, when it loop i am only available to pick 1 radio button even if theres 2 or more questions )
<?php
$tbl_name2="a_quiz"; // Switch to table "forum_answer"
$sql2="SELECT * FROM $tbl_name2 WHERE q_id='$id'";
$result2=mysql_query($sql2);
while($rows=mysql_fetch_array($result2)){
?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr style='overflow:hidden; word-wrap:break-word;'>
<td bgcolor="lightgreen"><strong>Question:</strong></td>
<td bgcolor="lightgreen">:</td>
<td bgcolor="lightgreen" style="max-width: 1000px;"><?php echo $rows['q_question'] ?></td>
</tr>
<tr>
<td bgcolor="lightgreen"><strong>A</strong></td>
<td bgcolor="lightgreen">:</td>
<td bgcolor="lightgreen"><input type="radio" name="<?php echo $rows['q_question'] ?>" value="a"><?php echo $rows['a'] ?></td>
</tr>
<tr>
<td width="18%" bgcolor="lightgreen"><strong>B</strong></td>
<td width="5%" bgcolor="lightgreen">:</td>
<td width="77%" bgcolor="lightgreen"><input type="radio" name="<?php echo $rows['q_question'] ?>" value="b"><?php echo $rows['b'] ?></td>
</tr>
<tr>
<td width="18%" bgcolor="lightgreen"><strong>C</strong></td>
<td width="5%" bgcolor="lightgreen">:</td>
<td width="77%" bgcolor="lightgreen"><input type="radio" name="<?php echo $rows['q_question'] ?>" value="c"><?php echo $rows['c'] ?></td>
</tr>
<tr>
<td bgcolor="lightgreen"><strong>D</strong></td>
<td bgcolor="lightgreen">:</td>
<td bgcolor="lightgreen"><input type="radio" name="<?php echo $rows['q_question'] ?>" value="d"><?php echo $rows['d'] ?></td>
</tr>
</table></td>
</tr>
<hr>
</table><br>
<?php
}
?>
my problem is i cannot get the values of the radio button
im trying $my_answer=$_POST['$q_question'];(and i think this is so wrong) + submit button
help me get the values of the radio button, using php
but if you got idea using javascript etc.. im happy to see it

Categories