the MySQL command that I am running is not updating the database. I have an image of the database in the image below showing all the various data fields (i.e. tokens).
Here is the code that is supposed to make a successful update but doesnt for some strange reason:
<?php
include('dbcategory.php');
$name_1 = "";
$institution_1 = "";
$instaddress_1 = "";
$monthto_1 = "";
$toyear_1 = "";
$monthto_1_1 = "";
$toyear_1_1 = "";
$graduate_1 = "";
$averages_1 = "";
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$idz = $_POST['idz'];
$full_name = $_POST['full_name'];
$name_1 = $_POST['name_1'];
/* echo $name_1; echo $full_name; */
$institution_1 = $_POST['institution_1'];
$instaddress_1 = $_POST['instaddress_1'];
$monthto_1 = $_POST['monthto_1'];
$toyear_1 = $_POST['toyear_1'];
$monthto_1_1 = $_POST['monthto_1_1'];
$toyear_1_1 = $_POST['toyear_1_1'];
$graduate_1 = $_POST['graduate_1'];
$averages_1 = $_POST['averages_1'];
$query12 = "UPDATE education SET `full_name`=?, `name_1`=?,`institution_1`=?,`instaddress_1`=?,`monthto_1`=?,`toyear_1`=?,`monthto_1_1`=?, `toyear_1_1`=?, `graduate_1`=?, `averages_1`=? WHERE `idz`=?";
$bb = $dbs->prepare($query12);
$bb ->execute(array($full_name, $name_1, $institution_1, $instaddress_1, $monthto_1, $toyear_1, $monthto_1_1, $toyear_1_1, $graduate_1, $averages_1, $idz));
}
/* if (isset($_SERVER["HTTP_REFERER"])) {
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
*/
?>
Here's the code for the forms that do the updating:
<?php
//Edit a product
//Input:
// id: id number of the product to edit. GET.
//Path from this page to the site root.
//Title of this page.
include('dbcategory.php');
//Fetch product data.
$idz = $_GET['idz'];
//$full_name = $_GET['full_name'];
$query = "SELECT * FROM education WHERE idz ='$idz'";
$record_set = $dbs->prepare($query);
$record_set -> execute();
$row = $record_set->fetch(PDO::FETCH_ASSOC);
$idz = $row['idz'];
$full_name = $row['full_name'];
$name_1 = $row["name_1"];
$institution_1 = $row["institution_1"];
$instaddress_1 = $row["instaddress_1"];
$monthto_1 = $row["monthto_1"];
$toyear_1 = $row["toyear_1"];
$monthto_1_1 = $row["monthto_1_1"];
$toyear_1_1 = $row["toyear_1_1"];
$graduate_1 = $row["graduate_1"];
$averages_1 = $row["averages_1"];
/*
*session start;
* dis is a session array;
* i is a session variable;
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body
{
background-image:url('../banner.jpg');
background-repeat:no-repeat;
background-position: center center;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<html>
<body>
<br><br><br>
<H2 align="center"><u>EDIT <?php print $name_1;?> </u></H2>
<form id="myform1" action="save-edited-applications.php" method="post">
<div id="div2">
<table border="1" align="center" cellspacing="0" style="margin-top:22px width="900"">
<colgroup>
<col span="1">
</colgroup>
<tr>
<td valign="top"><label for="name" size="3"> <font size="3">Name of Institution</font></label></td>
<td valign="top"><label for="institution" size="3"><font size="3">Type of Institution </font></label></td>
<td valign="top"><label for="instaddress" size="3"> <font size="3">Address</font></label></td>
<td valign="top"><label><font size="3">From</font></label></td>
<td valign="top"><label> <font size="3">To </font> </label></td>
<td valign="top"><label><font size="3">From</font></label></td>
<td valign="top"><label> <font size="3">To </font> </label></td>
<td valign="top"><label for="graduate" size="3"> Did You <br> Graduate?</label></td>
<td valign="top"><label for="averages"> Average <br>Grade</label></td>
<th>Save</th>
</tr>
<td valign="top">
<input type="hidden" id="idz" name="idz[]">
<input type="hidden" id="full_name" name="full_name[]">
<input type="text" name="name_1[]" id="name_1"
value="<?php print $name_1; ?>"> </td>
<td valign="top"><select name="institution_1[]" id="institution_1" >
<option <?php if(isset($_POST['institution'])) { echo $_POST['institution']; } ?>><?php print $institution_1; ?></option>
<?php
$sql1a = "SELECT * FROM institution ORDER BY institution asc";
$smt1a = $dbs->prepare($sql1a);
$smt1a -> execute();
while($row1a=$smt1a->fetch(PDO::FETCH_ASSOC))
{
if($row1a['institution']==$_GET['id3'])
echo("<option selected value='$row1a[institution]'>$row1a[institution]</option>");
else
echo("<option value='$row1a[institution]'>$row1a[institution]</option>");
}
?>
</select></td>
<td valign='top'><input type="text" name="instaddress_1[]" id="instaddress_1" size="30"
value="<?php print $instaddress_1; ?>"></td>
<td valign='top'><select name='monthto_1[]' id='monthto_1'> <option><?php print $monthto_1; ?></option>
<?php
$sql1a = "SELECT * FROM month ORDER BY id";
$smt1a = $dbs->prepare($sql1a);
$smt1a -> execute();
while($row1a=$smt1a->fetch(PDO::FETCH_ASSOC))
{
if($row1a['month']==$_GET['id6'])
echo("<option selected value='$row1a[month]'>$row1a[month]</option>");
else
echo("<option value='$row1a[month]'>$row1a[month]</option>");
}
?></select></td>
<td valign='top'><select name='toyear_1[]' id='toyear_1'> <option><?php print $toyear_1; ?></option>
<?php
$sql1a = "SELECT * FROM year ORDER BY year desc";
$smt1a = $dbs->prepare($sql1a);
$smt1a -> execute();
while($row1a=$smt1a->fetch(PDO::FETCH_ASSOC))
{
if($row1a['year']==$_GET['id7'])
echo("<option selected value='$row1a[year]'>$row1a[year]</option>");
else
echo("<option value='$row1a[year]'>$row1a[year]</option>");
}
?></select></td>
<td valign='top'><select name='monthto_1_1[]' id='monthto_1_1'> <option><?php print $monthto_1_1; ?></option>
<?php
$sql1a = "SELECT * FROM month ORDER BY id";
$smt1a = $dbs->prepare($sql1a);
$smt1a -> execute();
while($row1a=$smt1a->fetch(PDO::FETCH_ASSOC))
{
if($row1a['month']==$_GET['id6'])
echo("<option selected value='$row1a[month]'>$row1a[month]</option>");
else
echo("<option value='$row1a[month]'>$row1a[month]</option>");
}
?></select></td>
<td valign='top'><select name='toyear_1_1[]' id='toyear_1_1'> <option><?php print $toyear_1_1; ?></option>
<?php
$sql1a = "SELECT * FROM year ORDER BY year desc";
$smt1a = $dbs->prepare($sql1a);
$smt1a -> execute();
while($row1a=$smt1a->fetch(PDO::FETCH_ASSOC))
{
if($row1a['year']==$_GET['id7'])
echo("<option selected value='$row1a[year]'>$row1a[year]</option>");
else
echo("<option value='$row1a[year]'>$row1a[year]</option>");
}
?></select></td>
<?php if($graduate_1=="yes"){
echo "<td valign='top'>Yes<input type='checkbox' id='graduate_1' name='graduate_1[]' onclick='cleardata2(this)' value='$graduate_1' checked> No
<input type='checkbox' id='graduate_1' name='graduate_1[]' onclick='cleardata3(this)' value='no' disabled> </td>";
}
if($graduate_1=="no"){
echo "<td valign='top'>Yes<input type='checkbox' id='graduate_1' name='graduate_1[]' onclick='cleardata2(this)' value='yes' disabled> No
<input type='checkbox' id='graduate_1' name='graduate_1[]' onclick='cleardata3(this)' value='$graduate_1' checked> </td>";
}
?>
<td valign='top'><input type="text" name="averages_1[]" id="averages_1" value="<?php print $averages_1; ?>"></td>
<td valign='top'><button type="Submit" name="Save">Save</button></td>
</div>
</form>
</table>
<a href="origin.php" >BACK </a>
</body>
</html>
The image below shows the form to the code above:
The code runs and executes just fine without any errors in it - including the syntax or logic - but it fails to make any updates to the database tables. The tokens are in correct order. Why is not updating correctly?
Please let me know! Thanks a mill!!!
the url header for the form is: edit-education.php?idz='$idz'
i hope this helps out
Related
I am trying to filter an answer using 3 x which selected show a result.
Example 00.5em + 0.1 W + U-BAND := Shakar makar(Result)
After selecting all 3 I should get a result.
Result is taken from a table which is filled with information. But maybe I should choose something else ?
<table width="100%">
<thead>
<tr>
<th>Gate length</th>
<th>Output Power</th>
<th>BAND</th>
</tr>
<tr>
<th>
<select id="select1">
<?php
global $wpdb;
$results = $wpdb->get_results("SELECT DISTINCT pav FROM test");
foreach ($results as $res) { ?>
<option value="<?php echo $res->pav; ?>">
<?php echo $res->pav; ?>
</option>
<?php
}
?>
</select>
</th>
<th>
<select id="select2">
<?php
global $wpdb;
$results = $wpdb->get_results("SELECT DISTINCT pav2 FROM test");
foreach ($results as $res) { ?>
<option value="<?php echo $res->pav2; ?>">
<?php echo $res->pav2; ?>
</option>
<?php
}
?>
</select>
</th>
<th>
<select id="select3">
<?php
global $wpdb;
$results = $wpdb->get_results("SELECT DISTINCT pav3 FROM test");
foreach ($results as $res) { ?>
<option value="<?php echo $res->pav3; ?>">
<?php echo $res->pav3; ?>
</option>
<?php
}
?>
</select>
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3">Search result</td>
</tr>
<tr id="result">
<td data-green-1="" colspan="3">
FPA5501150D-P20
</td>
</tr>
</tbody>
</table>
Found some info from here (Filter table from <select> input using jQuery), but its not the right thing. Because all table should be hidden and only after selecting all options the result shown.
So main questions how to create a filtered table? O should I use different approach to this ?
Added. So After a while, I got to this point ->
in general.js i've updated :
$("select").click(function(){
var name1 = $('#select1').val();
var name2 = $('#select2').val();
var name3 = $('#select3').val();
console.log(name1)
$.ajax({
url: '/wp-admin/admin-ajax.php',
data: {
action:'table_block',
realname1: name1,
realname2: name2,
realname3: name3,
},
success: function (data){
$("#result").html(data);
}
})
})
and in function.php
add_action('wp_ajax_nopriv_table_block', 'table_list');
add_action('wp_ajax_table_block', 'table_list');
function table_list()
{
if (isset($_POST['realname1'], $_POST['realname2'], $_POST['realname3'])) {
$name1 = $_POST['realname1'];
$name2 = $_POST['realname2'];
$name3 = $_POST['realname3'];
global $wpdb;
$results = $wpdb->get_results("SELECT pav4, pav5 FROM test WHERE pav = '$name1' and pav2 = '$name2' and pav3 = '$name3'");
foreach ($results as $res) {
echo $res['pav4'], $res['pav5'] . "<br>";
}
}
}
The problem is I get an error
GET...wp-admin/admin-ajax.php?action=table_block&realname1=0.1%20um&realname2=0.1%20W&realname3=U-BAND 404 (Not Found). WHy it's not found ?
I am just trying to figure out the logic behind inserting form data into the database. Below code (load.php) works fine. Howewer I receive somehow a syntax error in process.php, besides I'm not sure if my insert code is correct. I also doubt this code is secure, what is the key security factor that I should consider while working with databases? I know I ask many questions but I just try to get the whole picture. I would appreciate any advice and thoughts.
thanks!
**//process.php**
<?php
require ("load.php");
$fname= $_POST['fname'];
$lname= $_POST['lname'];
$sql = "INSERT INTO registration (firstname, lastname) VALUES ('$_POST[fname]','$_POST[lname]')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
**//load.php**
<?php
$servername = "localhost";
$database = "registration";
$username = "root";
$password = "";
$conn = mysqli_connect($servername, $username, $password, $database);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
**//index.php**
<?php require ("load.php"); ?>
<html>
<head>
<title>Registration Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h3>Registration Form</h3>
<form name="registration" method="post" action="process.php">
<table border="0" cellspacing="2" cellpadding="2">
<tr><td>First Name:</td><td><input type="text" name="fname"></td></tr>
<tr><td>Last Name:</td><td><input type="text" name="lname"></td></tr>
<tr><td> </td><td><input type="submit" name="submit" value="Register"></td></tr>
</table>
</form>
</body>
</html>
Try following code for process.php
This will works
require ("load.php");
$stmt = $conn->prepare("INSERT INTO MyGuests (firstname, lastname) VALUES (?, ?)");
$stmt->bind_param("ss", $firstname, $lastname);
$fname= $_POST['fname'];
$lname= $_POST['lname'];
if ($stmt->execute()) {
echo "New record created successfully";
}
$stmt->close();
im Ivica and im new here.
i need form with 5 places for product codes. Every product have 4 rows (name, perex, amount, library_id) in database and i want place solution every products to different places.
Can help?
Sorry for my english.
DB CODE:
<?php
$mysqli = new mysqli('localhost', 'user', 'pass', 'db');
if ($mysqli->connect_error) {
die('Nepodařilo se připojit k MySQL serveru (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
$sql = $mysqli->query("SELECT library_id, amount, name, perex, extId
FROM product_item, main_library, product_item_price, product_text
WHERE product_item.product_id = main_library.main_id
AND product_item.id = product_item_price.item_id
AND product_item.product_id = product_text.product_id
AND product_item_price.level_id = 1 AND product_item.extId = '$test'");
echo 'Z databaze jsme ziskali ' . $sql->num_rows . ' radku.';
echo "</br>";
while ($produkt = $sql->fetch_assoc())
{
printf($produkt['name']);
echo "</br>";
printf($produkt['perex']);
echo "</br>";
printf($produkt['amount']);
echo "</br>";
}
$sql->free_result();
$mysqli->close();
?>
Example: I use form and try find 3 different products and these "name", "perex" and "amount" by ID and need to put those results in some tables with any places on page.
FORM:
<form action="search.php" method="REQUEST">
<b>Find product:</b>
<input type="text" name="productID" size="50">
<input type="text" name="productID2" size="50">
<input type="text" name="productID3" size="50">
<br>
<input type="submit" value="Search"> </form>
TABLE:
<table>
<tr>
<td>productID name</td>
<td>productID name</td>
<td>productID name</td>
<tr>
<tr>
<td>productID2 perex</td>
<td>productID2 perex</td>
<td>productID2 perex</td>
<tr>
<tr>
<td>productID3 amount</td>
<td>productID3 amount</td>
<td>productID3 amount</td>
<tr>
</table>
MYSQL look this:
$sql = $mysqli->query("SELECT library_id, amount, name, perex, extId
FROM product_item, main_library, product_item_price, product_text
WHERE product_item.product_id = main_library.main_id
AND product_item.id = product_item_price.item_id
AND product_item.product_id = product_text.product_id
AND product_item_price.level_id = 1
AND (product_item.extId = '$_REQUEST[productID]'
OR product_item.extId = '$_REQUEST[productID2]'
OR product_item.extId = '$_REQUEST[productID3]')");
Can help?
Ivica
I have a very basic and simple script that should display records from my database. The problem: it doesn't show all the records. I've tried it even with the most simple mysql
($sql="SELECT * FROM $tbl_name";) but still some records are missing (mostly the first of the list that isn't shown).
So here is my code (it's all on 1 page):
<?php
$host="localhost";
$username="***";
$password="***";
$db_name="***";
$tbl_name="***";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name WHERE rowNameOne >= 0.01 AND rowNameTwo='2013'";
if ($_GET['sort'] == 'one')
{
$sql .= " ORDER BY one ASC";
}
elseif ($_GET['sort'] == 'two')
{
$sql .= " ORDER BY two ASC";
}
elseif ($_GET['sort'] == 'three')
{
$sql .= " ORDER BY three ASC";
}
elseif($_GET['sort'] == 'four')
{
$sql .= " ORDER BY four ASC";
}
elseif($_GET['sort'] == 'five')
{
$sql .= " ORDER BY five ASC";
}
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>
<body onload="parent.alertsize(document.body.scrollHeight);">
<br />
<table cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top" colspan="5">
<font>Titel</font>
</td>
<tr>
<td>Titel one</td>
<td>Titel two</td>
<td>Titel three</td>
<td>Titel four</td>
<td>Titel five</td>
</tr>
<tr>
<td colspan="5" class="noBorder">
<?php
while($rows=mysql_fetch_array($result)){
?>
<a href="pageName.php?id=<? echo $rows['id']; ?>" >
<table width="100%">
<tr>
<td><? echo $rows['rowNameOne']; ?></td>
<td><? echo $rows['rowNameTwo']; ?></td>
<td><? echo $rows['rowNameThree']; ?></td>
<td><? echo $rows['rowNameFour']; ?></td>
<td><? echo $rows['rowNameFive']; ?></td>
</tr>
</table>
<input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>">
<?php
}
?>
</a>
</td>
</tr>
</table>
It's a very basic code, easy as can be I would say, but still it's missing records, not displaying everything that's in the database. What am I doing wrong?
Thanks for the help!
Before you start the loop, you do this:
$rows=mysql_fetch_array($result);
Then the loop condition is:
while($rows=mysql_fetch_array($result)){
So the first result is never shown. I would advice to remove the first statement, since you're not using its results between that statement and the loop.
On a related note, please consider moving to PDO or mysqli.
Actually I have a CGI form which consists of textfields and I need a combobox in which I can enter my own data dynamically. May be it seems very silly question but I am new to cgi-perl as well as HTML so no idea what to do. Here is my form:
#!C:\perl\bin\perl.exe
use CGI;
use CGI qw/:standard/;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
my $q = new CGI;
use DBI;
use CGI qw(:all);
use strict;
use warnings;
print "Content-Type: text/html\n\n";
print $q->header ( );
if ( $q->param("submit") )
{
process_form ( );
}
else
{
display_form ( );
}
sub process_form
{
if ( validate_form ( ) )
{
display_form ( );
}
}
sub validate_form
{
my $User_Name = $q->param("User_Name");
my $User_Password= $q->param("User_Password");
my $User_Permission = $q->param("User_Permission");
my $User_Department= join(", ",$q->param("User_Department"));
my $error_message = "";
$error_message .= "Please enter your name<br/>" if( !$User_Name );
$error_message .= "Please enter your Password<br/>" if( ! $User_Password );
$error_message .= "Please Select a permission<br/>" if( !$User_Permission );
$error_message .= "Please select atleast 1 department<br/>" if(!$User_Department);
if ( $error_message )
{
display_form (
$error_message,$User_Name,$User_Password,$User_Permission,$User_Department);
return 0;
}
else
{
my $dbh = DBI->connect("dbi:SQLite:DEVICE.db","", "",{RaiseError => 1, AutoCommit =>
1 } );
my $sql = "SELECT COUNT(UserName) FROM UsersList WHERE UserName='$User_Name'";
my $sth = $dbh->prepare($sql) or die("\n\nPREPARE ERROR:\n\n$DBI::errstr");
$sth->execute or die("\n\nQUERY ERROR:\n\n$DBI::errstr");
my ($n) = $dbh->selectrow_array($sth);
$sth->finish();
if ($n > 0) {
print "Record Already Exists";
}
else {
my $sql = "INSERT INTO UsersList (UserName,Password,Permission,Department) VALUES
('$User_Name ',' $User_Password','$User_Permission','$User_Department')";
my $sth = $dbh->prepare($sql);
$sth->execute;
print "Record Added Successfully";
$sth->finish();
$dbh->commit or die $dbh->errstr;
}
$dbh->disconnect;
}
}
sub display_form
{
my $error_message = shift;
my $User_Name = shift;
my $User_Password = shift;
my $User_Permission= shift;
my $User_Department= shift;
my $User_Permission_Add_sel = $User_Permission eq "Add" ? " checked" : "";
my $User_Permission_Edit_sel =$User_Permission eq "Edit" ? " checked" : "";
my $User_Permission_Delete_sel =$User_Permission eq "Delete" ? " checked" : "";
my $User_Permission_View_sel =$User_Permission eq "View" ? " checked" : "";
my $User_Department_html = "";
my $dbh = DBI->connect("dbi:SQLite:DEVICE.db","", "",{RaiseError => 1, AutoCommit =>
1 } );
my $sql = "select DepartmentName from Departments order by DepartmentName";
my $sth = $dbh->prepare($sql);
$sth->execute() ;
while (my $User_Department_option= $sth->fetchrow_array)
{
$User_Department_html.= "<option value=\"$User_Department_option\"";
$User_Department_html.= " selected" if ( $User_Department_option eq
$User_Department );
$User_Department_html.= ">$User_Department_option</option>";
}
$sth->finish();
$dbh->commit or die $dbh->errstr;
print <<END_HTML;
<html>
<head><title>Form Validation</title></head>
<body>
<form action="AddUser.cgi" method="post">
<input type="hidden" name="submit" value="Submit">
<p>$error_message</p>
<TABLE BORDER="1" align="center">
<TR>
<TD>Name</TD>
<TD> <input type="text" name="User_Name" value="$User_Name"></TD>
</TR>
<TR>
<TD>Password</TD>
<TD colspan="2"><input type="password" name="User_Password" value="$User_Password"
size="20" maxlength="15" /></TD>
</TR>
<TR>
<TD>Role</TD>
<TD>"HERE I NEED A COMBOBOX"</TD>
</TR>
<TR>
<TD>Permission</TD>
<TD><input type="radio" name="User_Permission"
value="Add"$User_Permission_Add_sel>Add<input type="radio" name="User_Permission"
value="Edit"$User_Permission_Edit_sel>Edit<input type="radio"
name="User_Permission" value="Delete"$User_Permission_Delete_sel>Delete<input
type="radio" name="User_Permission" value="View"$User_Permission_View_sel>View</TD>
</TR>
<TR>
<TD>Department</TD>
<TD colspan="2"> <select name="User_Department" MULTIPLE
SIZE=4>$User_Department_html</select></TD>
</TR>
</TR>
<TR>
<TD align="center" colspan="2">
<input type="submit" name="submit" value="ADD">
</TD>
</TR>
</TABLE
</form>
</body></html>
END_HTML
}
What you're looking for here isn't done on the Perl side, but on the HTML+Javascript side. As noted by others, HTML does not have a built-in combo box form element. So, you're stuck with Javascript.
Personally, I like using JQuery whenever working with Javascript. It's a Javascript library which makes manipulating web pages elements much easier.
Specific to your question, you'll want to look at http://jqueryui.com/demos/autocomplete/ (there is an actual combobox demo linked on the right, if you really, really need a combobox instead of a Google-style autocomplete text field.
Not related to the combobox, but you might also want to look at Template::Toolkit - a templating system for Perl (and others) that will allow you to take the HTML out of your perl scripts. Believe me, having the HTML embedded in CGI scripts for anything beyond the most basic usages will turn into a nightmare soon enough.
In place of "HERE I NEED A COMBOBOX" you have to write :
<select name='User_Department' id='User_Department'>
$User_Department_html
</select>
However, you retrieve parameters within your sub display_form but you've never passed any.