Recipe website? (without registration!)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
muov
Forum Newbie
Posts: 1
Joined: Sun Jun 04, 2017 6:48 am

Recipe website? (without registration!)

Post by muov »

Hello guys.
I would like to know how I can create a website like this:
https://ibb.co/j9cM5v
https://ibb.co/f2UqyF
https://ibb.co/cMDuQv

The first image is the homepage. Users can click on the water, wines or cocktails button.
If an user clicked the cocktails buttons, he would land on second image. He can post a new recipe (all the recipe are posted by anonymous users) or just click on one of them and take a look at the recipe. :D

Actually, I can already create the navigation system. I use, in html, this tag: <a href="cocktail.html">cocktails</a>
BUT I do not know if it is a good practice to do that in html because, theoretically, a new .html file would be created when posting a new recipe.

Could you tell me how to do a better navigation system and a "submit recipe" system? I just want to learn that without having to learn extra (non-important) stuff.

This is my background:
I know a lot of c.
I watched this two playlist in just two days and learnt almost everything
https://www.youtube.com/playlist?list=P ... 7Oyr1L9sPB
https://www.youtube.com/playlist?list=P ... vQjTw_aC9C

Just tell me what videos I should watch. Thank you all. :banghead:
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: Recipe website? (without registration!)

Post by Pazuzu156 »

First off, you should note it's not very good practice to generate new html pages for each recipe submitted. You'd do well to learn how to interact with databases using PHP. PDO is a built-in library for PHP, though there are other libraries out there you can use if you find messing with PDO directly a bit daunting.

The best way to accomplish something like this would be to store the data a user submits into your database, and use a single PHP file (with html of course, using php to get your data) and reference it by an id (usually the easiest way)

Example:

A user wishes to submit a new recipe, you have a link

Code: Select all

<a href="create.php">Create New Recipe</a>
this will link to a new page where a user can supply their data for submission.

This new recipe is inserted into the database with an id, let's say it's 4. You can then use a page recipe.php using this id to get it's information using a link like so

Code: Select all

<a href="recipe.php?id=4">My Amazing Cocktail</a>
There are tons of places to learn this sort of thing, but if you're just looking for videos, check this out. It's really good: https://www.youtube.com/watch?v=iCUV3iv ... 3603E83E5C
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
Post Reply