How to display date in next page? - php

I really need some help about how to pass returndate value in next page(save.php). the value that i cant' pass was under this "(input type='hidden' name='retDate[$i]' value='$retDate')".
I'm using calendar datepicker at this website(http://www.triconsole.com/php/calendar_datepicker.php). Appreciate if someone can help me about this and do refer below for my coding.
under "result.php"
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"></br>
<h1>RESULT </h1>
<p><b>Escalation Date : </b>
<?php echo $_POST["date1"] ?> until <?php echo $_POST["date2"] ?>
</p>
<?php
......
//Select database
$selected = mssql_select_db($myDB, $link)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT.....";
//execute the SQL query and return records
if ($result = mssql_query($query, $link)){
echo "<form name='form1' method='post' action='save.php'>";
echo "<table border='1'>
<tr>
<th>batch_exception_id</th>
<th>batch_id</th>
<th>process_date_time</th>
<th>Return Date</th>
</tr>";
$i=0;
while ($row = mssql_fetch_assoc($result)) {
$rDate = $row['ReturnDate'];
$beID = $row['batch_exception_id'];
$proc_dt = $row['process_date_time'];
echo "<tr>";
echo "<td>" . $beID . "<input type='hidden' name='beID[$i]' value='$beID'/></td>";
echo "<td>" . $row['batch_id'] . "</td>";
echo "<td>" . $proc_dt . "<input type='hidden' name='procDT[$i]' value='$proc_dt'/></td>";
if($rDate == ""){
echo "<td>";
$f_name="retDate[".$i."]";
$myCalendar = new tc_calendar($f_name, true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2000, 2020);
$myCalendar->dateAllow('2000-01-01', '2020-01-01');
$myCalendar->setDateFormat('j F Y');
$myCalendar->setAlignment('left', 'bottom');
//$myCalendar->setSpecificDate(array("", "0", "0"), 0, 'year');
//$myCalendar->setSpecificDate(array("0", "0"), 0, 'month');
//$myCalendar->setSpecificDate(array("0"), 0, '');
$myCalendar->writeScript();
echo "<input type='hidden' name='retDate[$i]' value='$retDate'/>";
//echo "<input type='hidden' name='retDate[$i]' value='".$myCalendar->getDate()."'/>";
$i++;
echo "</td>";
} else {
echo "<td>" . $rDate . "</td>";
}
echo "</tr>";
}
echo "</table><br/>";
echo "<input type='button' value='<<' onclick='history.back(-1)'/>";
echo "<input type='hidden' name='total_rec' value='$i'/>";
echo "<input type='submit' value='Save'/>";
echo "<input type='button' value='Print' onclick='window.print()'/>";
echo"</form>";
}
//close the connection
mssql_close($link);
?><br/>
</body>
under "save.php"
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"></br>
<?php
//$ReturnDate = $_POST["rDate"];
$arrbeID = $_POST["beID"];
$tot_rec = $_POST["total_rec"];
$arrprocDT = $_POST["procDT"];
$arrretDate = $_POST["retDate"];
for ($i=0; $i<$tot_rec;$i++) {
echo "Batch Esc. ID: ".$arrbeID[$i]."
| Proc. DateTime: ".$arrprocDT[$i]."
| Ret. Date: ".$arrretDate[$i]."
<br>";
}
?><br/>
</body>

I think you need this line:
echo "<input type='hidden' name='retDate[$i]' value='$retDate'/>";
to be:
echo "<input type='hidden' name='retDate[$i]' value='$rDate'/>";
because $rDate is where you have actually stored the return date that you fetched from the database:
$rDate = $row['ReturnDate'];

solution:-
Put below sript under head in Result.php
<link rel="stylesheet" title="Style CSS" href="cwcalendar.css" type="text/css" media="all" />
<script type="text/javascript" src="calendar.js"></script>
Add below code under body in Result.php
$date="date[".$i."]";
echo "<input type='text' name='date[$i]' id='$date' value=' ' onclick=\"fPopCalendar('".$date."')\">";
script reference:
http://codetale.com/2009/06/21/javascript-calendar-widget-108/

Related

POST checked and unchecked checkboxes with html php

I'm having hard time to figure it out how to insert the checked box-es or unchecked into the database with php.
I tried many many different ways but none is working, I think I'm very close but can't figure it out the problem.
Btw I work with Javascript and never worked with PHP except this time.
index.html
<html>
<head>
<style type="text/css">
#import "demo_page.css";
#import "header.ccss";
#import "demo_table.css";
#import "select.dataTables.min.css";
#import "jquery.dataTables.min.css";
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="RowGroupingWithFixedColumn.js"></script>
<script>$(document).ready(function(){load_(); console.log('load running')});</script>
</head>
<body id="dt_example">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="endpoints">
<thead>
<tr>
<th></th>
<th>Nr.</th>
<th>Java Class Name</th>
<th>http Method</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<?php
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,DB_NAME);
$sql='SELECT * FROM url';
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)) {
print $row['method'];
switch ($row['http_method']) {
case "GET":
echo "<tr class='gradeA'>";
break;
case "PUT":
echo "<tr class='gradeC'>";
break;
case "POST":
echo "<tr class='gradeU'>";
break;
case "DELETE":
echo "<tr class='gradeX'>";
break;
default:
echo "<tr>";
}
if($row['checked']){
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "' checked> </td>";
} else {
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "'> </td>";
}
echo "<td align=center >" . $row['number'] . "</td>";
echo "<td align=center >" . $row['class_name'] . "</td>";
echo "<td>" . $row['http_method'] . "</td>";
echo "<td style='font-weight:bold'>" . $row['endpoint'] . "</td>";
echo "</tr>";
}
if(isset($_POST['save'])){
echo "<script>console.log(" . $checkboxes.length . ");</script>";
$rows = $_POST['case'];
foreach($rows as $row){
$sql = "UPDATE url SET checked = 1 WHERE number = " . $case;
$result = mysqli_query($con,$sql);
}
}
mysqli_close($con);
echo "</tbody></table>";
echo "<input type='submit' name='save' id='save' value='Save' />";
?>
</body>
</html>
Any help would be appreciated.
image:
EDIT:
Solved - here is the code:
<?php
if(isset($_POST['save'])){
echo "<script>console.log(" . $checkboxes.length . ");</script>";
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,DB_NAME);
$rows = $_POST['case'];
foreach($rows as $row){
$sql = "UPDATE url SET checked = 1 WHERE number = " . $row;
$result = mysqli_query($con,$sql);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#import "demo_page.css";
#import "header.ccss";
#import "demo_table.css";
#import "select.dataTables.min.css";
#import "jquery.dataTables.min.css";
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="RowGroupingWithFixedColumn.js"></script>
<script>$(document).ready(function(){load_(); console.log('load running')});</script>
</head>
<body id="dt_example">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="endpoints">
<thead>
<tr>
<th></th>
<th>Nr.</th>
<th>Java Class Name</th>
<th>http Method</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<?php
$con = mysqli_connect('sql7.freemysqlhosting.net','sql7117068','GZqaZj69G9','sql7117068');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,'sql7117068');
$sql='SELECT * FROM url';
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)) {
print $row['method'];
switch ($row['http_method']) {
case "GET":
echo "<tr class='gradeA'>";
break;
case "PUT":
echo "<tr class='gradeC'>";
break;
case "POST":
echo "<tr class='gradeU'>";
break;
case "DELETE":
echo "<tr class='gradeX'>";
break;
default:
echo "<tr>";
}
if($row['checked']){
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "' checked> </td>";
} else {
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "'> </td>";
}
echo "<td align=center >" . $row['number'] . "</td>";
echo "<td align=center >" . $row['class_name'] . "</td>";
echo "<td>" . $row['http_method'] . "</td>";
echo "<td style='font-weight:bold'>" . $row['endpoint'] . "</td>";
echo "</tr>";
}
mysqli_close($con);
echo "</tbody></table>";
echo "<input type='submit' name='save' id='save' value='Save' />";
echo "</form>";
?>
</body>
</html>
PS: There may be many leaks and bad programming style in the code, but know that I'm not a PHP developer and it doesn't matter if there can be different attacks on my server. I only wanted to solve the problem and move on. Don't have time to stop at every point.
Use code below to check if a check box is checked or not. Then set some flags on some variables to insert data to to db accordingly.
//html
<input type='checkbox' name='boxname' value='1' />
//php
<?php
if(isset($_POST['boxname'])
{
echo "check box is checked";
}
?>

Not deleting values from Database using checkboxes

I have a quick question, I'm trying to use a function to delete a certain movie from a database using checkboxes. I can add stuff to the database just fine, but can't seem to delete using the checkboxes. Thanks in advance for your help!
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
</head>
<body>
<?
$db = new PDO("mysql:host=localhost;dbname=armstrongpz", "armstrongpz", "12345");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
<?
function deleteFromDatabase($db)
{
$deleteQuery = $db->prepare("SELECT * FROM movie");
$deleteQuery->execute();
foreach($deleteQuery->fetchAll() as $row)
{
if(array_key_exists($row['id'], $_POST))
{
$deleteQuery = $db->prepare('DELETE FROM movie WHERE movie.id='. $row['id']);
$deleteQuery->excute();
}
}
}
?>
<h2 style='text-align: center';>
Movie Collection Database
</h2>
<?
if($_SERVER['REQUEST_METHOD'] === "POST")
{
deleteFromDatabase($db);
if(isset($_POST['add']))
{
$TitleOfMovie = $_POST['TitleMovie'];
$StudioOfMovie = $_POST['StudioMovie'];
$RatingOfMovie = $_POST['mRating'];
$PubYearOfMovie = $_POST['PubYear'];
$IMDBRating = floatval($_POST['imdbRating']);
$RunTimeOfMovie = $_POST['RunTime'];
$addQuery = "INSERT INTO movie (id,title,studio,rating,pub_year,imdb_rating,run_time) VALUES(".'NULL'.", '$TitleOfMovie','$StudioOfMovie','$RatingOfMovie','$PubYearOfMovie', '$IMDBRating', '$RunTimeOfMovie')";
$statement = $db->prepare($addQuery);
$statement->execute();
}
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method='post'>
<table align='center' border='0' cellpadding='5'>
<tbody>
<tr>
<td style='border-style: none'>
<input name='TitleMovie' size='50' type='text' width='35' value= 'Title'/>
</td>
<td style='border-style: none'>
<input name='StudioMovie' size='25' type='text' width='35' value= 'Studio Name'/>
</td>
<td>
<?
$rating = array(1=>'G', 'PG', 'PG-13', 'R', 'NC-17', 'Not Rated');
echo "<select size='1' selected='movieRating' name='mRating'>";
foreach($rating as $key=>$value)
{
echo "<option value=\"$key\">$value</option>\n";
}
echo "</select>\n";
?>
</td>
<td style='border-style: none'>
<input name='PubYear' size='10' type='text' width='35' value='Pub Year'/>
</td>
<td style='border-style: none'>
<input name='imdbRating' size='10' type='text' width='35' value='IMDB rating'/>
</td>
<td>
<input name='RunTime' size='10' type='text' width='35' value='Run time'/>
</td>
<td>
<input type="checkbox" name="add" value="Add" align="top"/>Add
</td>
</tr>
<div style="text-align:center">
<input type='submit' name='submit' value='Update Database'>
</div>
</tbody>
</table>
</form>
<table border ='1' align='center'>
<?
$arrayOfFieldNames = array("Title", "Studio", "Rating", "Pub. Year", "IMDB Rating", "Run time(min)");
echo "<tr>";
echo "<td>". $arrayOfFieldNames[0] . "</td>";
echo "<td>". $arrayOfFieldNames[1] . "</td>";
echo "<td>". $arrayOfFieldNames[2] . "</td>";
echo "<td>". $arrayOfFieldNames[3] . "</td>";
echo "<td>". $arrayOfFieldNames[4] . "</td>";
echo "<td>". $arrayOfFieldNames[5] . "</td>";
echo "<td>Delete</td>";
echo "</tr>";
?>
<?
$query = "SELECT * FROM movie";
$stmt = $db->prepare($query);
$stmt->execute();
while($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
echo "<tr>";
echo "<td>" .$row['title']. "</td>";
echo "<td>" .$row['studio']. "</td>";
echo "<td>" .$row['rating']. "</td>";
echo "<td>" .$row['pub_year']. "</td>";
echo "<td>" .$row['imdb_rating']. "</td>";
echo "<td>" .$row['run_time']. "</td>";
echo "<td><input type='checkbox' name='". $row['id'] . "' value='" . $row['id'] . "'>Delete</td>";
echo "</tr>";
}
?>
</table>
<?
if(isset($db))
{
$db= null;
}
?>
</body>

I want to know how to get the selected data on another webpage using PHP

I have use loop to show limited data and each loop i have button to select it.
I have a syntax error in my view.php i dont know what to put in that query
How do i select a row in index.php to view more details in view.php. I tried giving it a name in the echo $rows; loop but i got syntax error too.
This is my code in index.php
<?php
$sqlQuery = mysql_query("SELECT fname FROM info");
while ($rows = mysql_fetch_array($sqlQuery)){
echo $rows['fname'];
echo "<input type='submit' value='Show more info' name='submit' class='btn btn-info'>";
}
?>
-----------------------end code for index------------------------------
this is my code in view
<?php
$sqlQuery = mysql_query("SELECT * FROM info WHERE fname=$_POST['fname']");
echo "<table border='1' width='50%'>";
echo "<tr>";
echo "<td>First Name</td>";
echo "<td>last Name</td>";
echo "<td>Age Name</td>";
echo "</tr>";
while ($rows = mysql_fetch_array($sqlQuery)){
echo "<tr>";
echo "<td>";
echo $rows['fname'];
echo "</td>";
echo "<td>";
echo $rows['lname'];
echo "</td>";
echo "<td>";
echo $rows['age'];
echo "</td>";
echo "</tr>";
}
echo "</table>";
?>
-------------------------------end code for view--------------------
<form method="POST" action="view.php">
<?php
$sqlQuery = mysql_query("SELECT fname FROM info");
while ($rows = mysql_fetch_array($sqlQuery)){
echo "<input type='text' value='".$rows['fname']."' name='fname'>";
echo "<input type='submit' value='Show more info' name='submit' class='btn btn-info'>";
}
?>
</form>
Try this in view.php
echo $_POST['fname'];
$query = "SELECT * FROM info WHERE fname LIKE ".$_POST['fname']."";
echo $query;
check what output are you getting

how to avoid duplicate values to print in the html table

Order.php:
<?php
require_once('conn.php');
session_start();
$itemId=$_SESSION['itemId'];
$tnumber=$_SESSION['tnumber'];
$custno=$_SESSION['custno'];
$sql="select itemId,subtitle,price,quantity from cart where tnumber='$tnumber'" ;
$sql2="select subtitle from cart where itemId='$itemId'";
$res2=mysqli_query($dbhandle,$sql2);
$row1= mysqli_num_rows($res2);
$res=mysqli_query($dbhandle,$sql);
$total=0;
?>
<html>
<head>
<title>Home</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type='text/css' href='cartbox.css'/>
</head>
<body>
<h1></h1>
<script src="home.js"></script>
<div id="shopping-cart"> </div>
<?php
echo "<table id='t1' border='1'>
<th>Subtitle</th>
<th>Quantity</th>
<th>Price</th>
<th>Amount</th>
</tr>";
if (row1 > 0) {
while ($row=mysqli_fetch_array($res)) {
$amount=$row['price']*$row['quantity'];
echo "<form id='addform{$row['itemId']}' method='post' action='cartdelete.php'> ";
echo "<tr>";
echo "<td>" .$row['subtitle'] ."</td>";
echo "<td>" .$row['quantity'] ."</td>";
echo "<td>" .$row['price'] ."</td>";
echo "<td>" . $amount . "</td>";
echo "<td><input type='submit' value='x' name='submit'></td>";
echo "<td><input type='text' name='itemId' value= '{$row['itemId']}'></td>";
echo"</form>";
echo "</tr>";
$total = $total+ $amount;
}
}
echo "</table>";
?>
<?php echo $total ?>
<input type="button" name="continue" value="Continue Order" style="position: absolute;top:200px;" onclick="location.href='customerdicecream.php'">
</body>
</html>
I'm trying to display the data in an HTML table (with primary key). I need the subtitle to be entered into the HTML table, only once, but with the if condition I'm not able to achieve it. How can I do that?
You may use DISTINCT / GROUP BY in your query for prevention of the redundant value.
ex.
$sql="select itemId,subtitle,price,quantity from cart where tnumber='$tnumber'" ;
$sql2="select DISTINCT subtitle from cart where itemId='$itemId'";
Reference Site
Define a variable $prevSubTitle before the while ($row=mysqli_fetch_array($res)) { condition.
And when you read value for it from $row['subtitle'], check if it matches with previously read value. If 'false' display new value, else fill td with a space as <td> </td>
#prevSubTitle = '';
while ($row=mysqli_fetch_array($res)) {
$amount=$row['price']*$row['quantity'];
echo "<form id='addform{$row['itemId']}' method='post' action='cartdelete.php'> ";
echo "<tr>";
$subtitle = $row['subtitle'];
if( ! ( $subtitle == $prevSubTitle ) ) {
$prevSubTitle = $subtitle;
}
else {
$subtitle = ' ';
}
echo "<td>" . $subtitle ."</td>"; // empty when matched with previous row title
echo "<td>" .$row['quantity'] ."</td>";
echo "<td>" .$row['price'] ."</td>";

Failed to pass an input variable to my query

I am creating a phonebook program, where I can register and create my own contact list. After login, the page will be directed to the tabmain page where I can view, add, edit or delete contact, in a multitab form.
Here's the problem: Whenever I click the save button (the button in function displayNew), it should be getting the first name and surname then, look for the database if there is a match. If not, then add it should them. Now, what happens is, after I click the save button, nothing is passed to the variable.
Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Tab-View Sample</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" type="text/css" href="css_collect/distribution/tab-view.css" />
</head>
<body>
<?php $id = isset($_GET['id']) ? $_GET['id'] : 1; ?>
<?php
include 'conSql.php';
session_start();
$mySession = $_SESSION['user'];
//displays firsname and lastname of the user
$getNames = getNames($mySession);
$gET = explode("^", $getNames);
echo "Hi, "."<b>". $gET[0] ." ". $gET[1] ."</b>"."!";
echo "</br>";
echo "</br>";
?>
<div class="TabView" id="TabView">
<!-- ***** Tabs ************************************************************ -->
<div class="Tabs" style="width: 452px;">
<a <?=($id == 1) ? 'class="Current"' : 'href="sample.php?id=1"';?>>Contact List</a>
<a <?=($id == 2) ? 'class="Current"' : 'href="sample.php?id=2"';?>>Add contact</a>
<a <?=($id == 3) ? 'class="Current"' : 'href="sample.php?id=3"';?>>Edit / Delete</a>
</div>
<!-- ***** Pages *********************************************************** -->
<div class="Pages" style="width: 450px; height: 300px;">
<div class="Page" style="display: <?=($id == 1) ? 'block' : 'none';?>"><div class="Pad"></div>
list of query
</div>
<div class="Page" style="display: <?=($id == 2) ? 'block' : 'none';?>"><div class="Pad"></div>
<Form Name ='' Method ='GET' action = 'tabmenu.php'>
<?php
displayNew();
if(isset($_GET['btnAdd'])){
$fname = $_GET['txtFname'];
$lname = $_GET['txtLname'];
// $s = "SELECT * ";
// $s .="FROM tbl_contactlist ";
// $s .="WHERE fname = '". $_GET['txtFname'] ."' and lname = '". $_GET['txtLname'] ."'";
echo $s;
}
?>
</div>
<div class="Page" style="display: <?=($id == 3) ? 'block' : 'none';?>"><div class="Pad"></div>
<?php
displayEdit();
?>
</div>
</div>
</div>
<script type="text/javascript" src="css_collect/distribution/tab-view.js"></script>
<script type="text/javascript">
tabview_initialize('TabView');
</script>
<?php
function getNames($mySession){
//get the real name of the user (firstname and lastname)
$s = "SELECT * ";
$s .="FROM tbl_users ";
$s .="WHERE username = '". $mySession ."' ";
$rc = mysql_query($s);
$row = mysql_fetch_assoc($rc) or die();
$details = $row["fname"]."^".$row["lname"];
return $details;
}
function displayNew(){
echo "<table border = '0'>";
echo "<tr>";
echo "<td colspan='2'><b>New Contact</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2'>Please fill up the fields.</td>";
echo "</tr>";
echo "<tr>";
echo "<td>First Name: </td>";
echo "<td><input type='text' name='txtFname' id='txtFname'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Last Name: </td>";
echo "<td><input type='text' name='txtLname' id='txtLname'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Nick Name: </td>";
echo "<td><input type='text' name='txtNicname' id='txtNicname'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Contact Number: </td>";
echo "<td><input type='text' name='txtContactNum' id='txtContactNum'></td>";
echo "</tr>";
echo "<tr>";
echo "<td></td>";
echo "<td><input type='submit' name='btnAdd' id='btnAdd' value='SAVE'></td>";
echo "</tr>";
echo "</table>";
}
function displayEdit(){
echo "<table border = '0'>";
echo "<tr>";
echo "<td colspan='2'><b>Edit / Delete Page</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2'>You can edit or delete:</td>";
echo "</tr>";
echo "<tr>";
echo "<td>First Name: </td>";
echo "<td><input type='text' name='txtFname' id='txtFname'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Last Name: </td>";
echo "<td><input type='text' name='txtLname' id='txtLname'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Nick Name: </td>";
echo "<td><input type='text' name='txtNicname' id='txtNicname'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Contact Number: </td>";
echo "<td><input type='text' name='txtContactNum' id='txtContactNum'></td>";
echo "</tr>";
echo "<tr>";
echo "<td></td>";
echo "<td><input type='submit' name='btnEdit' id='btnEdit' value='EDIT'>";
echo "<input type='submit' name='btnDelete' id='btnDelete' value='DELETE'></td>";
echo "</tr>";
echo "<tr>";
echo "<td></td>";
echo "<td><input type='submit' name='btnCancel' id='btnCancel' value='Cancel'></td>";
echo "</tr>";
echo "</table>";
}
function testMe(){
echo "<script type='text/javascript'>\n";
echo "alert('T E S T');\n";
echo "</script>";
}
?>
</body>
</html>
It looks like you don't ever close the form tag in the HTML, that might cause the page to not do anything when you click submit

Categories