Hi there,

As an excerise I am trying to create a basic PHP blog.

Creating the user login system was pretty straightforward, and I've 2 mySQL tables, one with user information, and one with the blog information (and with a foreign key referencing the user id).

However, I'm stuck for what to do next. Searches online don't seem to walk me through what I am after. Would somebody be able to point me vaguely in the right direction, such as what I should be looking into?

Basically, one method to populate a page with content that looked promising was using forms. User clicks a button (desguised with CSS as a link), which passes along the blog id to. BUT, I don't see how that method would work if I wanted a permalink to a particular blog post, since accessing the form action php would return invalid since the form hasn't been submitted yet.

Most blog sites seem to have url's without filenames at the end. I.e., blog.com/page ... How do they do this? Does that 'link' somehow submit data to the action form php, which is then used to display the content?

As you can see I'm a bit confused and a beginner with PHP, but hoping someone can help. Daniweb hasn't let me down yet!

Thanks in advance.

Recommended Answers

All 3 Replies

Hello James_43 , we call it friendly URL's . They are friendly also in S.E.O. perspective but also to final user. You must first understand how .htaccess work a bit , not something complicated just as how you can redirect the request to one php file. Then normally (without any weird logick in .htaccess) both e.g. categories and posts in your blog will have an URL segment in your DB, e.g. web-development/php/phpmysql-blog-general-questions would mean the post with URL segment “phpmysql-blog-general-questions” that is under the category with URL segment “php” that is under the category with URL segment “web-development”.

It seems to me that you move almost to the end without passing the other stages. In few words it has logic first to write down what you are trying to do (the demand) an then start planing the DB structure. After at least those steps you move to PHP

Thanks for that. I took what you said to Google and quickly found some further reading on this topic.

The key seems to be passing the data through an HTML query in order to dynamically generate the page content. I didn't think about this before since I only ever use POST not GET, but it makes a lot of sense here.

Seems quite straightforward now, the pretty urls can be an added extra. My understanding is that they simply redirect to the HTML GET query link.

Member Avatar for diafol

SImply put, GET is used to retrieve info, POST is used to modify info (on the server) or to pass passwords on a retrieve. A simple generator can be found here:

http://www.generateit.net/mod-rewrite/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.