Help with PHP and MySQL

User 96272 Photo


Ambassador
20 posts

Can anyone help me with PHP and MySQL? I need to add a page to a website I created for my VFW Post for vets to join or renew a membership. I have created the form but do not know how to check the validity of the data fields. I am also having problems connecting to the database I created on the hosting service we use.

Darlene
User 37670 Photo


Registered User
2,138 posts

Can you give us a link to your form so we can have a look. As for connecting to your database, a quick goole on "how to connec to db with php" should produce loads of content. You must be precise about the username and password used so that they match what was set up for the database on your server. CaPS CoUNt, so be carefull.
Can you tell us which data fields you are trying to check (names, numbers, email), and then those who know about php can provide the correct information for you. I guess we will see that on the form once we have a link, ;)
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
User 96272 Photo


Ambassador
20 posts

Hi Cliff,

I would like to take this one step at a time. First is the PHP coding needed for the form, then the PHP coding for field verifications, and finally the coding for transferring the form data to the databases.

As I have done programming in several other languages, basically all I need is one sample for each type of field so that I can adopt it to the other fields. For example, the coding for a phone number I can alter to check a Social Security Number. Fields such as these need to be checked for proper formatting according to the format shown to the right.

Email addresses need to be checked for proper format.

Here are specific requirements:
In the "Service Information" section -
For "Branch of Service" assure that at least one checkbox
is chosen.

For "Eligibility" assure that at least one checkbox is
is chosen and if the 'Other' box is chosen assure the
textbox next to it is not left blank.

For "Service Location" and "Campaign Medal or Ribbon"
assure they are not blank.

In the "Membership Type" section -
Assure one of the four checkboxes is chosen.

In the "Verification" section -
Assure the checkbox is chosen and the date field is not left
blank (it's format does not matter).

Here is the link to the form page:
http://vfw-post2605.org/join.html

Users to the website do not have access to this page as it is still under construction. After I get this all up and running with the databases (which I will show in a separate post) will I add this to the navigation menus on all of the other pages.

I hope you (or anyone else) understands what I have shown and need thus far.

Darlene
User 37670 Photo


Registered User
2,138 posts

Hi Darlene. Some of what you describe can be done with the CoffeeCup Form builder. I don't think it can handle the 'join or renew membership' part, which really is too bad. I'm just thinking off the top of my head that maybe it could be used for most of the fields, to put the information into the databse, and a shorter custom php script might be used for membership only stuff....just a thought for now. Have you tried CC form builder? You can get a free trial of the software to play with before spending any money to see if it helps you.
I don't have the time right now to show you examples of what you need, but I do hope to get some examples or at least links for you soon.
Here is a link to a quick and short blog that might help explain form validation with php. You might be able to adapt this to almost any field with a little trial and error.
http://htmlcenter.com/blog/php-form-validation/
Good Luck.
If the link does not help, please let us know so that someone might be able to explain it differently.
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
User 96272 Photo


Ambassador
20 posts

Thanks Cliff. I will certainly check out the options you presented. BTW, I just finished making two changes to the Join page... I added a checkbox near the top of the form for renewals (if it is chosen the Personal Info, Service Info, Membership Type, and Verification sections can be ignored) and the second was adding a textbox for a SSN to the Renewal Only section. I also changed the primary index for one of the tables of the db to 'ssn' which makes it compatable with the other table indexes.

I will need some time to check out the options you gave me so it might be several days before I post again.

Thanks again.

Darlene

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.