javascript - New page to be created automatically with separate URL

354

I'm very new to web development. I'm creating a travel website. Hotels details (id, Hotel name, location, description) are stored in a MySQL database. When submit the new hotel create form, I need a new page to be created automatically with separate URL. Can you help me to solve this problem?

939

Answer

Solution:

You can use GET parms in your hotel URL. For example:

hotel.php?hotelID=1

In your SQL database you save the hotelID. In thehotel.php you use$_GET['hotelID'] for you sql select statement and generate your site.

Your statement may look like this:

$hotelId = (int) $_GET['hotelID'];
$sql = "SELECT * FROM hotels WHERE hotelID = {$hotelId}";

People are also looking for solutions to the problem: php - Laravel Authentication Behaving Different for API Routes and Web Front End Routes

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.