473,383 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Can't Get Information to Display

I have used the following code so i could display information from mysql table on to the webpage but when i select a subject from the drop down menu nothing appears can someone please help.

Code

[PHP]<?php
$conn = mysql_connect ("localhost","root","")
or die (mysql_error());
mysql_select_db ("noble",$conn) or die (mysql_error());

if ($_POST[op] != "view") {
$display_block = "<h1>Select Entry</h1>";

$get_list = "SELECT Suit_ID, Suit_Brand as display_suit
FROM suits
ORDER BY suit_brand";
$get_list_res = mysql_query($get_list) or die (mysql_error());

if (mysql_num_rows($get_list_res) < 1) {
$display_block .= "<p><em>No Records</em></p>";

}else{
$display_block .= "
<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">
<p><strong>Select Brand</strong></p>
<select name\"Sel_id\">
<option value\"\">-- Select One --</option>";

while ($recs = mysql_fetch_array($get_list_res)){
$id= $recs ['Suit_ID'];
$display_suit = stripslashes ($recs['display_suit']);

$display_block .= "<option value=\"$id\">
$display_suit</option>";
}
$display_block .= "
</select>
<input type=\"hidden\" name=\"op\" value=\"view\">
<p><input type=\"submit\" name=\"submit\" value=\"View Selected Entry\"></p>
</form>";
}
} else if ($_POST[op] == "view") {

if ($_POST[Sel_ID] =="") {
header("location:selentry.php");
exit;

}

$get_master = "SELECT Suit_Brand, Suit_Type, Suit_Colour, Suit_Price, Suit_Description AS
display_suit
FROM suits
WHERE suit_id = $_POST[sel_id]";
$get_master_res = mysql_query ($get_master);

$display_suit = stripslashes (mysql_result ($get_master_res,0,'display_suit'));
$display_block = "<h1>Showing Record for $display_suit</h1>";

if (mysql_num_rows($get_master_res)>0) {

$display_block .= "<p><strong>Information:</strong></p>
<ul>";

while ($add_info = mysql_fetch_array($get_master_res)){
$Brand = $add_info[Suit_Brand];
$Type = $add_info[Suit_Type];
$Colour = $add_info[Suit_Colour];
$Price = $add_info[Suit_Price];
$Description = $add_info[Suit_Description];


$display_block .= "<li>$Brand $Type $Colour $Price ($Description)";


}

$display_block .= "</ul>";

}
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="Insert_Forms/NobleForms.css"/>
<title>Shirt Form</title>
</head>
<body>
<?php echo $display_block; ?>
</body>
</html>[/PHP]

Thanks in advance.
Mar 27 '08 #1
1 1354
ronverdonk
4,258 Expert 4TB
After the first submit the $_POST array contains a value. After the second submit from the generared form the $POST array does no longer contain that value from the first submit, but only the value from the generated form, i.e. the second submit.

Ronald
Mar 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Apple Plexy | last post by:
tearing my hair out here..., I am creating a site to show artists work. I have a database and can retrieve and display a list of artisits, other info, and a related image for each artist - all...
6
by: surrealtrauma | last post by:
i have a trouble about that: i want to ask user to enter the employee data (employee no., name, worked hour, etc.), but i dont know how to sort the data related to a particular employee as a...
1
by: John Phelan-Cummings | last post by:
When I add the name of a new individual in a, bound form, it will not display that person’s name in a label control of a second unbound form. I have a scheduling program that I am working on. ...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
1
by: keke3905 | last post by:
I really would appreciate some help on this assignment. I need to make GUI boxes to display the system info such as on Microsoft Office. I have some code but not sure where to go with the rest of...
109
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the...
1
by: Benny Ng | last post by:
Dear All, Now I met one problem in the development of my one application. I have one ASP.NET page. It's for disply the information of customer. But now I have one new requirement. It's to...
6
by: meyzhong | last post by:
Hi, I am new to Visual C++ (6.0). I want to put all the print information in different lines into a box. I create a EDIT dialogue box, and then add a CString variable (m_MSG) to the dialogue...
4
by: =?Utf-8?B?QmVu?= | last post by:
Hi all, I am trying to write a test console app in vb2008 express. Below is the code: Module Module1 Sub Main() Dim frm As New Form1 MsgBox("a test message") 'frm.Visible = True
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.