Hello,
I'm very new to PHP, and I have a question about something I'm working on. I'm the webmaster for a local organization that has a fall and a spring conference every year. People register by going to the website, printing out the registration form, and mailing it in to the treasurer with their payment. I was thinking of making an online registration form with PHP, which would e-mail the treasurer with all the info.
I got some PHP code from an aquaintance of mine, who used this form for an organization that she belongs to. I modified it to fit my particular organization, basing the fields on our previous (paper) registration forms. The code also uses JavaScript. (The person that I got the code from is very concerned about hiding e-mail addresses from spam bots, which is why the code is so long.) Right now I have my e-mail address set up as the one to receive registrations (just so I know that it's working). Assuming that my group approves of using online registrations, I would use our treasurer's e-mail address instead.
You can see the whole thing online at http://www.jmussehl.com/registrationform.html
This then takes you to http://www.jmussehl.com/submitted.php
You can see the code for the php document at http://www.jmussehl.com/submittedtext.html
One thing I had to account for is different registration costs. If you are a member, you pay $55, nonmembers pay $65, retirees pay $25 and students pay $25.
For this particular field, I gave the values names like "student25" in order to show both the registration type and the cost. But what I really wanted to do was have the registration type be one field (ie "student") and have the cost be a second field (ie "25.00").
So I created a code that would insert the correct cost, depending on the membership type the person chose.
if ($_REQUEST['regtype'] == "member55" )
{
$cost = '55.00';
}
else if ($_REQUEST['regtype'] == "nonmember65" )
{
$cost = '65.00';
}
else if ($_REQUEST['regtype'] == "unemployed25" )
{
$cost = '25.00';
}
else if ($_REQUEST['regtype'] == "student25" )
{
$cost = '25.00';
}
print $cost;
The reason I stuck that last bit of code in there (print $cost) was just to make sure that I had done everything correctly up until that point. This is why you'll see the cost at the very top of the submitted page, before the word "confirmation." I will remove that from the finished document.
Anyway, if you look at the confirmation page, with all the registrant's details (which is what gets sent to the treasurer via e-mail), the cost is blank. So every time I fill out this form, the server sends me an e-mail with all of the information, but nothing for the cost. I don't know what I did wrong. I e-mailed the person that I got the code from, and she thought it might be a problem with my using the wrong quotation marks or something. I've tried declaring the $cost variable with single quotes, double quotes, and no quotes, and that line is still always blank. Any suggestions?