Help for a total PHP newbie...

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
Evil Robot
Forum Newbie
Posts: 1
Joined: Tue Nov 11, 2003 7:13 pm

Help for a total PHP newbie...

Post by Evil Robot »

I recently got PHP enabled in my hosting and now I'm trying to use it to automate signups for community service events for my high school's community service club's website...so help the community, yeah.

I have a text file that has a bunch of numbers that is organized like so:

<event name>,<number of people who can attend (n)>,<id of person 1>,<id of person 2>,<id of person 3>,...,<id of person n>
<event name><event name>,<number of people who can attend (n)>,<id of person 1>,<id of person 2>,<id of person 3>,...,<id of person n>
...

Now what I'd like to do is be able to is take the user ID from a HTML POST form who selects his events via another HTML POST form and, if the event has not yet exceeded the number of people it should have, write his ID to the text file to the last id of the event he is signing up for. Otherwise, I'd like to indicate via a javascript pop up that the event is full and nobody can sign up. It'd be nice if I could e-mail the user IDs of the people who sign up to myself, but I'm not going to worry about that for now.

Please forgive me. Online tutorials and function lists aren't much help when you want to understand the problem as a whole. Any suggestions/easy learning?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

I have a text file that has a bunch of numbers that is organized like so:

<event name>,<number of people who can attend (n)>,<id of person 1>,<id of person 2>,<id of person 3>,...,<id of person n>
<event name><event name>,<number of people who can attend (n)>,<id of person 1>,<id of person 2>,<id of person 3>,...,<id of person n>
...
the best thing for you to do is learn how to read a CVS file. look for information on reading CVS files from php in google.

Now what I'd like to do is be able to is take the user ID from a HTML POST form who selects his events via another HTML POST form and, if the event has not yet exceeded the number of people it should have, write his ID to the text file to the last id of the event he is signing up for. Otherwise, I'd like to indicate via a javascript pop up that the event is full and nobody can sign up. It'd be nice if I could e-mail the user IDs of the people who sign up to myself, but I'm not going to worry about that for now.
all this is possible, you are just gonna have to do some research. The best places are 1) http://www.evilwalrus.com and 2) the manual provided to you on http://www.php.net
Please forgive me. Online tutorials and function lists aren't much help when you want to understand the problem as a whole. Any suggestions/easy learning?
unfortunately, there is no easy way for you to learn php. we can't just say "do these things and now you are a php guru". you are gonna need to buy a book on php and learn these things on your own. However, after you start coding and run into a problem, paste what you have done so far, and ask for suggestions. we'll always help you out, but we can't write the entire thing out for you :)

hope that helps.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

infolock wrote: you are gonna need to buy a book on php
no you wont :P

you can learn just as much from the net, i mean, it IS a web based language, so the best place would be on the web, where info is the most current
User avatar
mrvanjohnson
Forum Contributor
Posts: 137
Joined: Wed May 28, 2003 11:38 am
Location: San Diego, CA

Post by mrvanjohnson »

This reply isn't going to be much help but I am going to post it anyways.

Your solution is fairly easy and can be done a couple of ways (the beauty of PHP) using either a database of flat file. The problem is you don't want to seem to want to learn how to do it.

You mentioned tutorials don't seem to help you and looking for something easy to learn. My friend you are talking PHP, on of the easiest to learn, so go learn it. If the manual at PHP.net isn't much help and you don't care for tutorials then I'm not sure where to tell you to learn it.

I don't mean to come off as a prick but you have to understand what you are asking. You don't want to learn how to do it you want someone to write the application for you. Which is fine but post it as a project that you are looking for help with? Not that you want to learn how to do it but not obtain the knowledge.

I know you said tutorials don't help but you are asking for a fairly basic database application. Check out some of these and see if they can't be of some help.

http://www.devshed.com/Server_Side/PHP/DB_Basics/
http://www.phpfreaks.com/tutorials/40/0.php
http://blazonry.com/scripting/linksdb/index.php

If you don't have a database then start to learn and understand [php_man]fopen[/php_man] and [php_man]array[/php_man]s.

When you have some code, or a general direction post back, there are tons of people here, me included, who would love to help you.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

lilpunkskater : i guess i was posting based on my own experience. i learn better out of books then i do off the net, but i did point out the manual on the net :) but mrvanjohnson pretty much summed up what i was trying to say :P
Post Reply