PHP와 HTML 코딩에 익숙하지 않아서 매우 유감스럽게 생각합니다.
내 문제는 다음과 같습니다. 일단 사용자가 로그인하여 웹 사이트의 홈페이지로 이동하면 양식의 제출을 클릭하기 전에 $str_result
과 $str_comments
이 표시됩니다. 이 // Your code here to handle a successful verification
말한다 어디 당신은 실제로 if()
를 작성해야
<?php
//If connected to the database get services names from database and write out DropDownMenu
mysqli_select_db($db_server, $db_database);
$query = "SELECT ID, Name FROM categories ORDER BY Name";
$result = mysqli_query($db_server, $query);
if (!$result) die("Query failed: " . mysqli_error($db_server));
while($row = mysqli_fetch_array($result)){
$str_options .= "<option value= '" . $row[ 'ID'] . "'>";
$str_options .= $row['Name'];
$str_options .= "</option>";
}
mysqli_free_result($result);
// Your code here to handle a successful verification
$str_result = "<h2>Thanks for your search! Services avaliable are:" .
$category = clean_string($db_server, $_POST["categories"]) . "</h2>";
?>
<!--form-->
<form method="post" action="nihome.php"><p>I am searching for</p>
<select name="categories"><?php echo $str_options; ?></select>
<br />
<input type="submit" id="submit" name="submit" value="Submit" />
</form>
<?php
//Capture form data, if anything was submitted
if (isset($_POST['categories']) and ($_POST['categories'] != '')){
$category = clean_string($db_server, $_POST['categories']);
// create the SQL query
$query = "SELECT salon.ID AS ID, categories.Name as Category, salon.salon_name AS Salon, services.name AS Service, servicesoffered.price AS price FROM services
JOIN categories ON services.cID = categories.ID
JOIN servicesoffered ON servicesoffered.serviceID = services.ID
JOIN salon ON servicesoffered.salonID = salon.ID WHERE categories.ID=$category";
// query the database
mysqli_select_db($db_server, $db_database);
$result = mysqli_query($db_server, $query);
if (!$result) die("Database access failed: " . mysqli_error($db_server));
// if there are any rows, print out the contents
while ($row = mysqli_fetch_array($result)) {
$str_result .= '<h3>' . $row['Salon'] . ',</h3><p>' .
$row['Service'] . ", £" .
$row['price'] .'</p>' .<a href="salonpage.php?salonid=' . $row['ID'] .'">Click here to view or add to salon reviews</a>';
}
if($str_result == "") $str_result = "<h2>No services found</h2>";
} else {
$str_result = '<h2>No service was requested</h2>';
}
mysqli_close($db_server);
echo $str_result;
echo $str_comments;
?>
전에' '이 (아포스트로피)이 누락'은'
왜 downvotes? OP는 그가 PHP에 새로운 사람이라고 분명히 말했고 그는 노력을했습니다. 그는 누군가를 위해 코드를 작성하는 데 도움을 요청하지 않습니다. – AdRock
사람들은 질문을 읽지 않고 downvote를 질겁합니다! wtf –