//flex table opened by JP

Click to See Complete Forum and Search --> : Submit Form


seanieboy77
10-10-2007, 03:17 AM
Hey guys I need your help. I really don't know where I should go or even where to start. But here is what I'm looking to do. I want to make a submit form but you get to choose where you sbmit it to. Not like submitting to other sites but submitting to my site but different catagoeries. For example a person posting a link about a movie, and they choose the movie section. So their post goes there. And another person posts a link about a song and it goes to the music section. Hopefully that helps to clarify what I am looking to do. I don't know if its to be written in PHP or Javascript, I'm pretty sure PHP but not sure. Can anyone also give me any links to help me create that? Thanks for all help in advance!
-BTY

jjinno
11-02-2007, 02:15 PM
You've got everything you need already... that is if you can program in PHP & javascript.

Using only your idea, I would go about it like this:

First make sure you can use PHP (your idea) and that you have someplace to store your data (text file, SQL, etc) and that you know how to use it
Second make a form (method = post is probably best for you), and give it a select/option field that allows the user to choose what category to submit to. Make sure that you have the name attribute specified in the select tag, and the value attribute specified in all of your options.
Try looking at this for an example. (http://www.quirksmode.org/js/select.html)
Next, in PHP-land, access your $_POST vars, and extract them to find out :

What did the user specify as the category?
What was the link they submitted?

Because you can access your $_POST variables however you like, you can parse them into nice little hashes to use later.
A link to learn about POST & GET, PHP-style (http://www.tizag.com/phpT/postget.php)
Check IF the user hit submit, and if so, write your data-structure to SQL/file/whatever... This means that you store the information in the correct places... like appending the link to the "music" database when the user selects "music", etc....... but if there was no submit, then someone is spoofing you, so throw any POST data away.
You can have either the same page be the submit/view page, or you can create a separate script to do each task. The viewing is the easiest task however, cause all you have to do is read each of those databases (SQL-tables/files/whatever) and display the info on-screen in the already practically formatted manner.


Hope this helps. The difficulty should always be in the "putting" of data to a database, never on the "getting"... so KISS=Keep It Simple Stupid