I am working on classified website in which user will post his ads to sell something. It is basically my first web project. I have problem in making self creating pages in which when user post his ad it will generate an HTML page automatically and link and little glimpse of his ad show on a proper well designed another ad page.
Here I have described my problem properly:
- When user presses submit ad button an html page will be created automatically and user will be directed to that page (how to create that page)?
- How to place link of ad page on the top of other previous ads those are too on self-created page dynamically?
Here is random code of inserting and displaying database on the page:
<!DOCTYPE html>
<html>
<body>
<form action="zain.php" method="post">
Topic: <input type="text" name="topic"><br />
<br />
Name: <input type="text" name="name"><br /><br />
Attendance: <input type="text" name="attendance"><br />
<br />
<input type="reset" name="reset">
<input type="submit" name="submit" value="Go">
</form>
<?php
$user = 'root';
$password = 'zz224466';
$db = 'Zain';
// Create connection
$conn = mysqli_connect('localhost', $user, $password, $db);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "";
mysqli_select_db($conn, "zain");
$insert = "INSERT INTO lectures (Topic,Name,Attendence) VALUES('$_POST[topic]','$_POST[name]','$_POST[attendance]')";
mysqli_query($conn,$insert);
///////////Write records on the Screen//////////////
$sql = "SELECT * FROM lectures";
$myData = mysqli_query($conn,$sql);
while($record=mysqli_fetch_array($myData)){
echo $record['Topic']. " "
." ". $record['Name']." ".$record['Attendence'];
echo "<br>";
}
mysqli_close($conn);
?>
</body>
</html>
Can you please show me some hints to solve my problem?