Forums, Search Engine, Date. What next?



I'm sorry, but I've just got to laugh at this.

dvduval said:
I've done quite a bit with PHP without really knowing what I'm doing. First, I created forums by PHPbb, just like this one. Then I created a search engine

Then, wanting to see what else I might do, I went and bought a 'Beginning PHP' from WROX. So far, all I've done is make my home page 'index.php' and put the date on the page. I hope to do more, but my creativity has slowed down.

You've created a forum and a search engine without knowing what you were doing? So then you bought a book, learned PHP properly and then on your newest venture you've just managed to insert the date on a page? :lol: And now you're stuck for more ideas?

I'm sorry but I find that incredibly funny!
dvduval said:
Have I found a village of idiots here? Or are there a couple of all-knowing seers?
Well, I hope us Moderators and Admins fall under the all-knowing :D

Anyways, I recommend you write your own script. A form is nice and simple and easy way of getting your feet wet so to speak. First of all start off writing a form in HTML, set the action of the page to basename($_SERVER['PHP_SELF']) so your form line should read:
<form action='<?=basename($_SERVER['PHP_SELF'])?>'>
Note the <? ?> tags to start and stop PHP anywhere within standard HTML, such is ease of use. Anyway, don't forget to set the method to GET or POST

Then, at the top of your page you can insert the following code:
if (sizeof($_POST)) {
print "<pre>\n";
print "</pre>\n";
That will display your form results in an Array. You can change $_POST to $_GET depending on your form action. Look up Super Global Arrays in the manual for more info.

Now you've got your form results as an Array, I suggest you learn to manipulate Arrays. Again all the info can be found in the manual, but since it's not very beginner friendly (in my experience) I recommend using your book which will probably explain it better!

Now you've learned how to manipulate an Array, learn MySQL and set up a database to store this info. You'll need to learn how to connect to the Db, create a table, and insert the data. Then you'll need to learn how to retrieve it. You can use the mysql_fetch_array() feature to return the results as an Array, which by now you will know how to control. Then it's a simple case of displaying it how you want.

I think that's enough to get you started. If you get any problems you know where to come :)