Hello I am a noobie and I have a problem!
I have writen the script:
<HTML>
<HEAD>
<TITLE>Records</TITLE>
</HEAD>
<BODY>
<?php
$conn = mysql_connect("localhost", "----", "----")
or die (mysql_error());
mysql_select_db("dimva_travel_agency", $conn) or die (mysql_error());
if ($POST !="view") {
$display_block = "<h1>Journeys</h1>";
$get_list = "select id, concat_ws(',', destinations) as display_name
from Tours order by destinations";
$get_list_res = mysql_query($get_list) or die(mysql_error());
if (mysql_num_rows($get_list_res) < 1) {
$display_block .= "<p><em>Sorry, no records to select!</em></p>";
} else {
$display_block .= "
<form method=\"post\"action=\"$SERVER[PHP_SELF]\">
<p><strong>Special Offers:</strong><br>
<select name=\"sel_id\">
<option value=\"\">-Destinations-</option>";
while ($recs = mysql_fetch_array($get_list_res)) {
$id = $recs['id'];
$display_destinations = stripslashes($recs['display_name']);
$display_block .= "<option value=\"$id\">
$display_destinations</option value>";
}
$display_block .= "
</select>
<input type=\"hidden\"name=\"op\"value=\"view\">
<p><input type=\"submit\"name=\"submit\"
value=\"View Selected Destination\"></p>
</FORM>";
}
} else if ($POST[op] == "view") {
if ($POST[sel_id] == "") {
header("Location: php.php");
exit;
}
$get_Tours = "select concat_ws('',Destinations) as display_destinations
from Tours where id = $_POST[select_id]";
$get_Tours_res = mysql_query($get_Tours);
$display_destinations = stripslashes(mysql_result($get_Tours_res,
'display_destinations'));
$display_block = "<h1>$display_destinations</h1>";
$get_destinations = "select destinations
from destinations where master_id = $_POST[sel_id]";
$get_destinations_res = mysql_query($get_destinations);
if (mysql_num_rows($get_destinations_res) > 0) {
$display_block .= "<p><strong>Destination:</strong><br>
<ul>";
while ($add_info = mysql_fetch_array($get_destinations_res)) {
$destinations = $add_info[destinations];
$display_block .= "<li>$destinations";
}
$display_block .= "</ul>";
}
$get_departure = "select departure, type from Tours where
master_id = $_POST[sel_id]";
$get_departure_res = mysql_query($get_departure);
if (mysql_num_rows($get_departure_res) > 0 ) {
$display_block .= "<P><strong>Departure Date:</strong><br>
<ul>";
while ($departure_info = mysql_fetch_array($get_departure_res)) {
$departure = $departure_info[departure];
$display_block .= "<l1>$departure";
}
$display_block .= "</ul>";
}
$get_duration = "select duration from Tours where
master_id = $_POST[sel_id]";
$get_duration_res = mysql_query($get_duration);
if (mysql_num_rows($get_duration_res) > 0) {
$display_block .= "<P><strong>Duration:</strong><br>
<ul>";
while ($duration_info = mysql_fetch_array($get_duration_res)) {
$duration = $duration_info[duration];
$display_block .= "<li>$duration";
}
$display_block .= "</ul>";
}
$get_price = "select price from Tours where
master_id = $_POST[sel_id]";
$get_price_res = mysql_query($get_price);
if (mysql_num_rows($get_price_res) > 1) {
$display_block .= "<P><strong>Price:</strong><br>
<ul>";
while ($price_info = mysql_fetch_array($get_price_res)) {
$price = $price_info[price];
$display_block .= "<li>$price";
}
$display_block .= "</ul>";
}
$display_block .= "<br><br><P align=center>
<a href=\"$_SERVER[PHP_SELF]\">select another</a></p>";
}
?>
<? print $display_block; ?>
</BODY>
</HTML>
And I find 5 bugs (line 23, 56, 74, 92, 109). I have a MySQL database which is :