Using Sourcerer and Jumi in inserting PHP codes in Joomla - Joomla! Forum - community, help and support
hi. i'm trying build simple application requires user enter username , password view school grades. tried using jumi , sourcerer using these codes:
<html>
<head><style>
tr {text-align:center;}
</style>
</head>
<body>
<form method=post>
id: <input type=text name="id"<br /><br />
password: <input type=password name="password"><br /><br />
<input type=submit name="submit" value="search grade" /><br /><br />
</form>
<?php
if(isset($_post['submit'])){
if(!empty($_post['id']) , !empty($_post['password'])){
$id = "";
$password = "";
$id = $_post['id'];
$password = $_post['password'];
$con = mysql_connect("localhost","myusername","mypasword");
mysql_select_db("joomlasite",$con);
$sql = "select * malachi id = $id , password = $password";
$grades = mysql_query($sql,$con);
if(!$grades){
echo "no records found in database"."!";
mysql_close($con);
}
else {
echo "<table cellpadding=5 cellspacing=5 border=1 bgcolor=lightblue>
<tr><th>id</th><th>name</th><th>english</th><th>math</th><th>science</th><th>social</th><th>calculus</th></tr>";
while($record = mysql_fetch_assoc($grades)){
echo "<tr>";
echo "<td>" . $record['id'] . "</td>";
echo "<td>" . $record['name'] . "</td>";
echo "<td>" . $record['english'] . "</td>";
echo "<td>" . $record['math'] . "</td>";
echo "<td>" . $record['science'] . "</td>";
echo "<td>" . $record['social']. "</td>";
echo "<td>" . $record['calculus'] . "</td>";
mysql_close($con);
}
}
}
else
echo "please fill out missing fields" . "!";
}
?>
</body>
</html>
if leave input box blank, says "fill out...". if enter correct values, show record using html table. if enter invalid values, says "no records found", if enter numbers both fields, though no records found, still shows table without contents. also, table shown separate window(image attached) below form unpleasant. hope can me figure out. in advance.
<html>
<head><style>
tr {text-align:center;}
</style>
</head>
<body>
<form method=post>
id: <input type=text name="id"<br /><br />
password: <input type=password name="password"><br /><br />
<input type=submit name="submit" value="search grade" /><br /><br />
</form>
<?php
if(isset($_post['submit'])){
if(!empty($_post['id']) , !empty($_post['password'])){
$id = "";
$password = "";
$id = $_post['id'];
$password = $_post['password'];
$con = mysql_connect("localhost","myusername","mypasword");
mysql_select_db("joomlasite",$con);
$sql = "select * malachi id = $id , password = $password";
$grades = mysql_query($sql,$con);
if(!$grades){
echo "no records found in database"."!";
mysql_close($con);
}
else {
echo "<table cellpadding=5 cellspacing=5 border=1 bgcolor=lightblue>
<tr><th>id</th><th>name</th><th>english</th><th>math</th><th>science</th><th>social</th><th>calculus</th></tr>";
while($record = mysql_fetch_assoc($grades)){
echo "<tr>";
echo "<td>" . $record['id'] . "</td>";
echo "<td>" . $record['name'] . "</td>";
echo "<td>" . $record['english'] . "</td>";
echo "<td>" . $record['math'] . "</td>";
echo "<td>" . $record['science'] . "</td>";
echo "<td>" . $record['social']. "</td>";
echo "<td>" . $record['calculus'] . "</td>";
mysql_close($con);
}
}
}
else
echo "please fill out missing fields" . "!";
}
?>
</body>
</html>
if leave input box blank, says "fill out...". if enter correct values, show record using html table. if enter invalid values, says "no records found", if enter numbers both fields, though no records found, still shows table without contents. also, table shown separate window(image attached) below form unpleasant. hope can me figure out. in advance.
Comments
Post a Comment