kayz
12-30-2008, 03:00 PM
Hi guys i have a simple form where people register for their tickets which allows them to indicate how many additonal persons they are brining.
I was successfully able to add up the rows to display total registered users. However the additonal boxes are radio buttons up to 5. Each option is a "1,2,3,4,5" interger.
On the member list view i can see the list of registered users and i see how many people each person is brining male and female.
What i dont know how to do is add up all the additional female users and the additional male users they will be brining. So it should give me a total number of how many additional female members and male members that are coming?
There are two coloumns.. "additonal males" and "additional females", i want it to show me a total of all additonal users based on their gender.. something like.. "Additional female users coming = 10" the 10 being a $variable and the same for males.
Thats the most important thing first.. secondly if its possible i would like it to add the registered user to the male/female coloumn depending on their gender. So the registered user should be on the tally of either "Total Females Attending" or "Total Males Attending" based on their gender.
Here are parts of my form and code..
Registration form:
<tr>
<td>
Your Gender.
<br />
<input type="radio" name="male" value="male">Male
<input type="radio" name="female" value="female">Female
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
How many additional <b>"Male"</b> persons you are likely to bring.
<br />
<input type="radio" name="malepersons" value="none">Just myself
<input type="radio" name="malepersons" value="1 Male">1
<input type="radio" name="malepersons" value="2 Males">2
<input type="radio" name="malepersons" value="3 Males">3
<input type="radio" name="malepersons" value="4 Males">4
<input type="radio" name="malepersons" value="5 Males">5
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
How many additional <b>"Female"</b> persons you are likely to bring.
<br />
<input type="radio" name="femalepersons" value="none">Just myself
<input type="radio" name="femalepersons" value="1 Female">1
<input type="radio" name="femalepersons" value="2 Females">2
<input type="radio" name="femalepersons" value="3 Females">3
<input type="radio" name="femalepersons" value="4 Females">4
<input type="radio" name="femalepersons" value="5 Females">5
</td>
</tr>
The registration processing into db:
$query = "INSERT INTO ticket_registration (firstname, surname, email, contact_no, malepersons, femalepersons, date)
VALUES('$firstname', '$surname', '$email', '$contact_no', '$malepersons', '$femalepersons', '$date')";
mysql_query($query) or die(mysql_error());
$ticketid = mysql_insert_id();
mysql_close();
Viewing Total Users Registered (but i dont know how to display the total number of additonal female/male registered. :(
<?php
$link = mysql_connect("localhost", "xxxxxx_ticket", "xxxxxx");
mysql_select_db("xxxxxx_etticket", $link);
$result = mysql_query("SELECT * FROM ticket_registration", $link);
$num_rows = mysql_num_rows($result);
echo "$num_rows";
?>
Any help would be much much appreciated.
Cheers
I was successfully able to add up the rows to display total registered users. However the additonal boxes are radio buttons up to 5. Each option is a "1,2,3,4,5" interger.
On the member list view i can see the list of registered users and i see how many people each person is brining male and female.
What i dont know how to do is add up all the additional female users and the additional male users they will be brining. So it should give me a total number of how many additional female members and male members that are coming?
There are two coloumns.. "additonal males" and "additional females", i want it to show me a total of all additonal users based on their gender.. something like.. "Additional female users coming = 10" the 10 being a $variable and the same for males.
Thats the most important thing first.. secondly if its possible i would like it to add the registered user to the male/female coloumn depending on their gender. So the registered user should be on the tally of either "Total Females Attending" or "Total Males Attending" based on their gender.
Here are parts of my form and code..
Registration form:
<tr>
<td>
Your Gender.
<br />
<input type="radio" name="male" value="male">Male
<input type="radio" name="female" value="female">Female
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
How many additional <b>"Male"</b> persons you are likely to bring.
<br />
<input type="radio" name="malepersons" value="none">Just myself
<input type="radio" name="malepersons" value="1 Male">1
<input type="radio" name="malepersons" value="2 Males">2
<input type="radio" name="malepersons" value="3 Males">3
<input type="radio" name="malepersons" value="4 Males">4
<input type="radio" name="malepersons" value="5 Males">5
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
How many additional <b>"Female"</b> persons you are likely to bring.
<br />
<input type="radio" name="femalepersons" value="none">Just myself
<input type="radio" name="femalepersons" value="1 Female">1
<input type="radio" name="femalepersons" value="2 Females">2
<input type="radio" name="femalepersons" value="3 Females">3
<input type="radio" name="femalepersons" value="4 Females">4
<input type="radio" name="femalepersons" value="5 Females">5
</td>
</tr>
The registration processing into db:
$query = "INSERT INTO ticket_registration (firstname, surname, email, contact_no, malepersons, femalepersons, date)
VALUES('$firstname', '$surname', '$email', '$contact_no', '$malepersons', '$femalepersons', '$date')";
mysql_query($query) or die(mysql_error());
$ticketid = mysql_insert_id();
mysql_close();
Viewing Total Users Registered (but i dont know how to display the total number of additonal female/male registered. :(
<?php
$link = mysql_connect("localhost", "xxxxxx_ticket", "xxxxxx");
mysql_select_db("xxxxxx_etticket", $link);
$result = mysql_query("SELECT * FROM ticket_registration", $link);
$num_rows = mysql_num_rows($result);
echo "$num_rows";
?>
Any help would be much much appreciated.
Cheers
