Jump to content

NOOB: Tell me what to do


Go to solution Solved by requinix,

Recommended Posts

Hi Guys,

I am really new person to all this and working on my semester project, so don't mind if my question is a little childish or off topic.

Here is what I want my website to do:

           An admin Input the data from admin panel in the form for example title, description, a picture and a new webpage is created dynamically which will title as the title of webpage, show the picture and description where I want it to......kind of like facebook where you just click on the "create new event" link and it asks for the Name of the event and a new webpage is created with your event name as the title etc. (Sorry can't think of any other example)
            Does it require any additional knowledge like XML or javascript?
Oh! and thanks in advance :-)

Link to comment
https://forums.phpfreaks.com/topic/284433-noob-tell-me-what-to-do/
Share on other sites

  • Solution

Nope, nothing fancy. All you need is a database to store the information and a little PHP to add stuff and to show stuff.

 

Start by writing the admin page without any database interaction to the point where you have the information you want (title, description, and uploaded picture) into variables. Then write the "show" page to the point where you start with variables with that data (you'll get those from the database later) and outputs the page how you want it.

 

Note that you never actually create a "new webpage". You don't make a file for every event but instead have URLs like "showevent.php?id=123"; that ID tells showevent.php what event information (from the database) to show on the page. If you want a fancier URL, like "event/example-event-123", that can happen easily later.

Yes, you will use $_GET.

 

So for example if your page id was '123' your url will be 'mypage.com/page.php?id=123'

 

Then you would use $_GET to pull the id from the URL...

$pageId = $_GET['id'];

... and using MySQL you would then look up in the database all of the details associated with the id '123' , with a query such as below;

SELECT * FROM mytable WHERE `id` = '$pageId' 

Note that you will need to read up on techniques to avoid SQL injection, as what I've suggested above is open to abuse if the GET value is not escaped correctly.

 

Preferably learn mysqli or PDO, and read up on the use of prepared statements.

Edited by paddyfields
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.