Forum Moderators: coopster
I am as my name suggests totally new to PHP and mySQL. However, I have no choice but to learn, and learn fast!
I have gone into business with a friend and our business will be reliant on a website for members and results logging.
I have my database set up, I've learnt how to query it and can import data and add new rows from withing PHPmyAdmin.
What I now need to learn is how to show a dynamic form, and record those results into the database, also I need to learn how to use PHP to exctrat data base on user inputted variables!
I have 4 tables in mysql: Player, Venue, Position, Points.
I need to record player points scored at each venue, so a web based form that has a drop down to select the venue (from the list available in the databse) a text box asking how many players took part, which then creates a form based on that number of players. The form would need record position finished and membership number of the player and record this info into the Position table!
I also need to run several other queries to report on data held in the database, these will be reliant on the user inputting things like, membership number and venue, to show all the points earnt at a given venue by a certain player!
I don't expect anyone to hand me a bunch of code and say there you go I did it for you.
But I would really appreciate a few simple explainations on what I need to understand to make this happen.
By the way I have a PHP & MYSQL FOR DUMMIES book in front of me, but I can't find a suitable description that is similar to what I need!
Thanks ain advance
Have you had a browse through our library [webmasterworld.com]? You may find some useful code snippets/tutorials there.
dc
Got my dropdown box working using the following code:
$query="SELECT VenueName,VenueID FROM Venue ORDER BY VenueName";
$result = mysql_query ($query);
echo "<select VenueName=Venue value=''>Venue Name</option>";
// printing the list box select command
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[VenueID]>$nt[VenueName]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
Help enourmously by the library ;-)
My next question is how can I get a form to add rows depending on a user input field. For example my form has the fileds Position, MembershipNo & Name.
However the Position is prefilled (1, 2, 3 etc), the MembershipNo is user inputted and the Name is displayed using the membership number previously entered (sanity check)
But before the form is displayed I want to ask the question How many Players? Then if the user inputs 20, I get 20 form rows with positions 1 - 20 prefilled. or if the user puts in 16, I get 16 rows and so on.
Any one got any ideas on where I start?
Thanks