Hi there,

I'm lost in webSpace. I'm building a website for an amateur football team. One of the pages I'm including, "nextGame.html" will enable our players to declare their availability for a certain match by adding their name to a list of names already displayed on that page. I've started off by trying to create a simple form. However, I'm completely lost at the action end. I'd rather use PHP as my PC is ASP disabled, so I've also started to create a PHP file. Haven't got far though.

Does anybody have any tips on this matter?

Thanks for any help.

Matt

Where are you getting the original list of names from? Are they in a database?

Member Avatar for diafol

Do you have pHp/MySQL installed on your PC and your host? If not, you'll need to sort this out. You can install apache/php/mysql from XAMPP. If you cannot do these, the only thing I can think of is using Perl CGI and files to store your data (bit of a pain).

You'll probably need some sort of login function to stop unauthorized users from messing up your data. Either that or use htaccess to protect the entire site with a popup login.

This is pretty trivial for experienced programmers, but can be a bit of a challenge for newbies. Search out some free scripts. Sorry if I got the wrong end of the stick.

My first website was similar to what you want (It was a site for my parents association) but I decided to use the Joomla CMS system because there are loads of add ons such as calendars. I will admit that joomla is not like a walk in the park and does take some getting used to but it means that once I had made the site I could edit it without having to add a single bit of code

If you don't want it to get too complicated why don't you use a service rather than build it from scratch? More specifically, something like Google Docs or a free forum where you could have an item for each game. These have sign-in capabilities. Not sophiticated but could work. There could be something free out on the web that would allow you to register people. Otherwise, you are probably into installing a CMS or building something.

Thanks for your response,

At first I wanted them to come from a database, but as the football team frequently has new players coming and going I figured it would be too painstaking to constantly update the database. So I settled for this arrangement:

Players go to the website, they read the details of the next game, and then they follow the instructions: "If you are able to play in this game, please type your name in the box and click submit."

If they choose to type their name and submit, then their name is then added to a list and the list is then displayed on that same page. Therefore, the list is constantly growing as more players add their name to it.

In short the names are input from the viewer of the website.

I'm not too worried about protecting the data or preventing misuse as it is a website for a (very) small amateur football team.

Sorry if I come across as being too specific.

Thanks again

If you don't want it to get too complicated why don't you use a service rather than build it from scratch? More specifically, something like Google Docs or a free forum where you could have an item for each game. These have sign-in capabilities. Not sophiticated but could work. There could be something free out on the web that would allow you to register people. Otherwise, you are probably into installing a CMS or building something.

I don't mind if it gets too complicated I'm doing this for several reasons, one of them is that I want to challenge myself.

Complexity?! Bring it on!

My first website was similar to what you want (It was a site for my parents association) but I decided to use the Joomla CMS system because there are loads of add ons such as calendars. I will admit that joomla is not like a walk in the park and does take some getting used to but it means that once I had made the site I could edit it without having to add a single bit of code

Joomla? I've heard of this somewhere. I'll look it up. Thanks

Do you have pHp/MySQL installed on your PC and your host? If not, you'll need to sort this out. You can install apache/php/mysql from XAMPP. If you cannot do these, the only thing I can think of is using Perl CGI and files to store your data (bit of a pain).

You'll probably need some sort of login function to stop unauthorized users from messing up your data. Either that or use htaccess to protect the entire site with a popup login.

This is pretty trivial for experienced programmers, but can be a bit of a challenge for newbies. Search out some free scripts. Sorry if I got the wrong end of the stick.

Thanks for the response,

I have those installed on my PC. I'm not too fussed about protecting the data just yet, perhaps later down the line. It's a small site aimed at a smaller group. The only thing I'll get is silly nicknames from people adding their names to the list. But we're not going to be too miffed at that happening.

Member Avatar for diafol

OK

Your tables should be set up as follows:

players:
player_id (int, 3, autonumber, primary key)
name (varchar, 50)
pw (varchar, 32)

matches:
match_id (int, 3, autonumber, primary key)
venue (varchar, 50)
homeaway (char, 4)
kickoff (datetime)

availability:
id (autonumber, primary key)
player_id (int, 3)
match_id (int, 3)
available (tinyint,1) 1=true, 0 = false

[tinyint could be used for player id/ match id instead, but a bit of experimenting and false entries could take you over the mx no. allowed for this datatype]

Your page should have something like:

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method = "post">
<label for="player">Player:</label>
<input type="text" id="player" name="player" />
<label for="pw">Password:</label>
<input type="password" id="pw" name="pw" />
<input type ="radio" id="available" name="status" value="true" />
<label>Available</label>
<input type ="radio" id="notavailable" name="status" value="false" />
<label>Not Available</label>
<input type ="submit" id="submitA" name="submitA" value="Send Info" />
</form>

As a rule, you should avoid sending the form to the same page, but you said you wanted a simple solution.

Seeing as you want a challenge, I won't include the code for the data handling, but I will give you a few pointers

At the top of the page (before the DTD):

check to see if the form has been sent with isset on the submit button name.
if not, carry on displaying the page.
if it has, check the player name and password against the database values.
if all ok, check to see if the player has already entered availability - if so, use UPDATE syntax. If not use INSERT syntax.

This should give you a current list.

For extra bit of niceness, you could show a list of available players and unavailable players just above the form.

Everybody can then see who can play, who can't and who hasn't bothered replying yet!

The only thing is, you'll have to change your mysql statements after each game to point to the next match.

Hey Ardav,

Wow, that's one hell of a reply!! You're right about the niceness. I'm looking to include the list of available and unavailable players on the form itself. Anyway once my daughter stops crying, I'm gonna try and get started on the database, and I'll let you know how it goes.

Thanks again.

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.