-2
<form action="results.php" name="Search" method="post">
    <label>Search by Last Name:</label> <input class="inputbox" type="text" name='lastname'>
    <input class="button" type="submit" value="Search" name="lastnamesearch" />
</form><?php
$conn = oci_connect ('TBEETS', '********', 'oradev');

$curs = oci_new_cursor($conn);

$sql = "begin :output :=TBEETS.USER_PKG.SELECT_LAST_NAME(:VAR_LAST_NAME); end;";    
$stmt = oci_parse($conn, $sql);
$LAST_NAME="BEETS";
oci_bind_by_name($stmt, ":output", $curs, -1, OCI_B_CURSOR);
oci_bind_by_name($stmt, ":VAR_LAST_NAME", $LAST_NAME);    
oci_execute($stmt); 
oci_execute($curs);
while ($row = oci_fetch_array($curs, OCI_ASSOC + OCI_RETURN_NULLS)){
    $output[] = $row;
}

oci_free_statement($stmt);
oci_free_cursor($curs);

oci_close($conn);

I need help with results.php to display a row with the last name that is being searched. Not sure how to get the 'lastname' to match the variable LAST_NAME

Tyler
  • 1
  • 2

2 Answers2

1

In results.php, you can retrieve the last name with:

$lastname = $_POST['lastname'];

To display it in a row, simply append it into your HTML output:

...
echo "<tr><td>$lastname</td></tr>";
...
Cᴏʀʏ
  • 105,112
  • 20
  • 162
  • 194
  • okay i can get it to echo my _POST but how can I get my search form to spit out results from an array with 'lastname'? – Tyler Dec 01 '14 at 18:13
0

In results.php, you can get data by using $_POST method

$lname = $_POST['lastname'];

$sql = "select * from tb_name where col_name = '".$lname."' ";
$result = mysql_query($sql);
while($row = mysql_fetch_array$result()) {
  $id = $row['col_name'];
  //echo your data with 
}
jay.jivani
  • 1,560
  • 1
  • 16
  • 33
  • `mysql_` functions were officially deprecated. Please don't promote them, especially to novice developers. See [Why shouldn't I use mysql_* functions in PHP?](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). – Cᴏʀʏ Dec 01 '14 at 18:56