HMG + PHP simplexml_load_file()

HMG en Español

Moderator: Rathinagiri

franco
Posts: 821
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: HMG + PHP simplexml_load_file()

Post by franco »

I have set up a local server. I need help at start of code to get username and password, also what is in clist3.txt to put in folder.

AT START
????? $user = input(user) ???? an input box to pass parameter
?????? $ cCode = input(Password)
I can get following code to work but no data in report. I took out get cCode and entered my own but no table info

Code: Select all

>html
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;" />
<head>
<style>
table {
	width:70%;
}
table, td, th {
	border: 1px solid black;
	border-collapse: collapse;
}
h1 {
	color: #00A;
}
</style>
</head>
<body>
<?PHP
//include('./settings.php'); 

//if ( $_GET["cCode"] == false )
//{                                                                                              I TOOK THIS AREA OUT
//	print "You dind't send client code!";
//	exit;
//}
$cRequestedClient = '10001';                    //$_GET["cCode"];
print "<h1>Sale of client: ".$cRequestedClient."</h1><br>";
print '<table>';
print "<th>No</th><th>Item</th><th>Description</th><th>Price</th><th>Saleprice</th>";
$SalesFile = './CLLIST3.TXT';
$lines = file($SalesFile);
$no=1;
$total1=0;
$total2=0;
foreach ($lines as $line) {
	$aline=explode(',',$line);
	$cCodeClientSale = trim($aline[0]);
	
 	if($cCodeClientSale==$cRequestedClient	)
	{
		print "<tr>";
		print "<td>".$no."</td>";
		print "<td>".$aline[1]."</td>";
		print "<td>".$aline[2]."</td>";
		print "<td>".$aline[3]."</td>";
		print "<td>".$aline[4]."</td></tr>";
		$total1+=$aline[3];
		$total2+=$aline[4];
		$no++;
	}
}
print "<tr>";
print "<td></td>";
print "<td></td>";
print "<td>TOTAL</td>";
print "<td>".$total1."</td>";
print "<td>".$total2."</td></tr>";
print "</table>";
?>
</body>
</html>
Thanks this is getting me started with php.
Franco
Last edited by franco on Mon May 25, 2020 9:44 pm, edited 1 time in total.
All The Best,
Franco
Canada
User avatar
mol
Posts: 3723
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG + PHP simplexml_load_file()

Post by mol »

Php code is running on the server side. You can't do interaction with user in php.
You can create html code to enter username and password and then sent it with POST to php file.
If you want to secure it, you have to use session at least.
franco
Posts: 821
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: HMG + PHP simplexml_load_file()

Post by franco »

Is this the html code you mean

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;" />
<head>
<style>
table { >>>>>>>>>>>>>>>

Franco
All The Best,
Franco
Canada
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: HMG + PHP simplexml_load_file()

Post by apais »

This is Roberto's HMGWEB running on apache + mod_harbour:
https://www.mod-harbour.com/hmgweb/tableadv_a.prg
Angel Pais
Web Apps consultant/architect/developer.
Post Reply