Search Results

edited August 2009 in Internet & Media
Ive been trying to solve this issue for a while now but seem to get nowhere. Basically, I have a search box in the page in which when you enter a spec ref, it displays what you search. The serach does work, but I want the results to be displayed in the text box called Spec Ref.

This is my coding:
[html]
$myServer = '*****';
$myUser = '***';
$myPass = '****;
$myDB = '****';
$SpecRef = $_GET;
print ("$SpecRef");

//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");


//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//error message (not found message)begins
$XX = "No Matches Found";
//query details table begins
$query = ("SELECT * FROM dbo.DesignControl WHERE Spec_Ref LIKE'$SpecRef%' ");
// $query = ("SELECT * FROM dbo.DesignProcess");
print(' is what you searched for:');

//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "" . $numRows . " Record" . ($numRows == 1 ? "" : "s") . " Found

";
//display the results
echo '<textarea>'; <br /> while($row = mssql_fetch_array($result)) <br /> {<br /> echo $row["Spec_Ref"] . "\n"; }<br /> echo '</textarea>';
//close the connection
mssql_close($dbhandle);
//display the results
while($row = mssql_fetch_array($result))
{
echo "" . $row["Spec_Ref"] . "
";
}
//close the connection
mssql_close($dbhandle);
//textareaContent = "";
//while ($row = @mysql_fetch_array($query))
//{
//$var1=$row["Player"];
//$var2=$row["Avg"];
//$var3=$row["HR"];
//$var4=$row["RBI"];
$textareaContent .= "Spec Ref: $var1 Avg: $var2 HR: $var3 RBI $var4
";
//}
//if (!isset($var1) || $var1=="") {
//echo $XX;
//}
?>

<form id="form1" name="form1" method="post" action="search.php">

<label> </label>
Pre Press Date 1 2 3


<input name="name_<? echo $row; ?>" id="name_<? echo $row; ?>" value="<? echo $row; ?>" type="text">
Job Description
<label for="textfield2"></label>

<input name="name_<? echo $row; ?>" id="name_<? echo $row; ?>" value="<? echo $row; ?>" type="text">
Spec Ref
<label for="textfield3"></label>


<input name="SpecRef" id="SpecRef" size="40" value="" action="Search.php" columns="2" autocomplete="off" delay="1500" type="text">
<input value="Search" type="submit">
<input name="search" value="1" type="hidden">

Repro House/design agency
<input name="name_<? echo $row; ?>" id="name_<? echo $row; ?>" value="<? echo $row; ?>" type="text">
End User Family

<input name="name_<? echo $row; ?>" id="name_<? echo $row; ?>" value="<? echo $row; ?>" type="text">

<label for="textfield5"></label>
X Ref
<label for="textfield6"></label>

<input name="name_<? echo $row; ?>" id="name_<? echo $row; ?>" value="<? echo $row; ?>" type="text">
Cust Ref:
<label for="textfield7"></label>

<input name="name_<? echo $row; ?> type=" text="" id="name_<? echo $row; ?>" value="<? echo $row; ?>">
<input name="Submit" value="Update" type="submit">



New Flash
<input name="checkbox5" id="checkbox5" type="checkbox">
Promotion
<input name="checkbox6" id="checkbox6" type="checkbox">
Price Flash
<input name="checkbox7" id="checkbox7" type="checkbox">
<input name="textfield7" id="textfield7" size="10" type="text">


New
<input name="checkbox" id="checkbox" type="checkbox">
NBOS
<input name="checkbox2" id="checkbox2" type="checkbox">
NBOR Supercession
<input name="checkbox3" id="checkbox3" type="checkbox">
QA
<input name="checkbox4" id="checkbox4" type="checkbox">


<form action="Pre-press.php" method="get">
<input name="query" id="query" size="40" value="" action="Pre-press.php" columns="2" autocomplete="off" delay="1500" type="text">
<input value="Search" type="submit">
<input name="search" value="1" type="hidden">
</form>
[/html]

Comments

  • LincLinc Owner Detroit Icrontian
    edited July 2009
    This is a good example of how not to ask for help. First, your post was all jacked up because you pasted a bunch of HTML and didn't bother to fix it. Second, you don't give basic background like "Hey this is PHP" or "this is both the form and the catcher" etc. Third, I have no idea what you're trying to do here or where you perceive the problem to be.

    I've corrected the post's formatting, but I'm not going to read through a hundred lines of code to find what the problem is before I can start pondering the solution.
  • GooDGooD Quebec (CAN) Member
    edited August 2009
    LoL im with you on this one Lincoln, i wont read it either ;)

    Plus, the more i work with c# the more i hate to read PHP :P
Sign In or Register to comment.