Tables HTML Toolkit [message #1060835] |
Tue, 28 May 2013 14:55 |
Joaquin Morcate Messages: 52 Registered: March 2010 |
Member |
|
|
Hi all!
I'm trying to check the text in cell in HTML table. This is the HTML code of that displays the table:
<? include("langsettings.php"); ?>
<html>
<head>
<title>Phone Book HTML</title>
<link href="phonebook.css" rel="stylesheet" type="text/css">
</head>
<body>
<p>
<!-- Title displayed in the web page -->
<h1>PHONE BOOK</h1>
<?
// Create (connect to) SQLite database in file
$file_db = new PDO('sqlite:contacts.sqlite3');
// Set errormode to exceptions
$file_db->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
?>
<!-- form section -->
<form action=phonebook.php?action=add& method=post>
<center>
<table border=0 cellpadding=0 cellspacing=3>
<!-- This is the first row of the form diplaying name and phone -->
<tr>
<td>Name</td><td><input type=text size=20 name=name></td>
<td>Phone</td><td><input testid="phone3" name="phone2" type=text size=20 name=phone></td>
</tr>
<!-- This is the second row of the form diplaying first name and photograph -->
<tr>
<td>First Name</td><td> <input type=text size=20 name=firstName></td>
<td>Photograph</td><td> <input type=text size=20 name=photo></td>
</tr>
<!-- Third row of the form displaying the button -->
<tr>
<td colspan=4> <input onclick="return error('KK')" class="tabbutton" type=submit border=0 value="SAVE NEW CONTACT" ></td>
</tr>
</table>
</center>
</form>
<center>
<table name="Contactos" testid="Contactos" border=0 cellpadding=0 cellspacing=0>
<?
$DO_YOU_WANT_TO_DELETE = "Do you want to delete ";
$FROM_YOUR_CONTACTS_LIST = " from your contacts list?";
$ERROR_MSG_NO_PHONE = "Please provide phone Number";
$ERROR_MSG_NO_NAME = "Please provide name";
$ERROR_MSG_NO_FIRST_NAME = "Please provide first name";
$action=@$_REQUEST['action'];
$firstname=@$_REQUEST['firstName'];
$name=@$_REQUEST['name'];
$phone=@$_REQUEST['phone'];
$photo=@$_REQUEST['photo'];
if($action=="add")
{
if ($photo=="") {
$photo="resources/no_image.png";
}
if ($firstname=="") {
echo "<script language='JavaScript'>
alert(\"$ERROR_MSG_NO_FIRST_NAME\");
</script>";
} else if ($name=="") {
echo "<script language='JavaScript'>
alert(\"$ERROR_MSG_NO_NAME\");
</script>";
} else if ($phone=="") {
echo "<script language='JavaScript'>
alert(\"$ERROR_MSG_NO_PHONE\");
</script>";
} else {
$file_db->query("INSERT INTO contacts (name, firstName, phone, photograph) VALUES('$name','$firstname','$phone','$photo')");
}
}
if(@$_REQUEST['action']=="del")
{
$file_db->query("DELETE FROM contacts WHERE contact=".round($_REQUEST['id']));
}
$result=$file_db->query("SELECT
contact,firstName, name, phone, photograph
FROM contacts ORDER BY name");
foreach($result as $row) {
echo "<tr>";
echo "<td class=tabphoto><img src=".$row['photograph']." width=100 height=100></td>";
echo "<td class=tabval>".$row['firstName']." ".$row['name']."</td>";
echo "<td class=tabval><img class='textmiddle' src='resources/telephone25.png' width='25' height='25'>".$row['phone']." </td>";
echo "<td class=tabval><a onclick=\"return confirm('".$DO_YOU_WANT_TO_DELETE.$row['firstName']." ".$name.$row['name'].$FROM_YOUR_CONTACTS_LIST."');\" href=phonebook.php?action=del&id=".$row['contact']."> <img class='textmiddle' src='resources/trash30.png' width='25' height='25'></a></td>";
echo "</tr>";
}
$file_db = null;
?>
</table>
</center>
</body>
</html>
I don't manage to check the contents of the cells. I use a Check Text(Specify Cell) and for the second column (displaying the full name) I enter 2 for the Column attribute. I think that I'm not specifying the row/column well because the test always fails independently if I set "equals" or "not equals" for the Text Operator. From the documentation I understand that you can enter the column/row indexes but the parameter is marked as String.
Any idea what I'm doing wrong? Thank you
Joaquin Morcate
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02922 seconds