Hi kakra,
I appreciate your coming to the forum for help. Since this is appears to be a school assignment, I will try to give you some strong hints at things to do or change. Feel free to post your changes and I will continue to try help you in this capacity.
You did a nice job with your form, but there are a few things I would suggest:
[ul][li]I would strongly suggest adding a !DOCTYPE declaration as well as a meta charset. The form should display fine without them, but they really should be included in almost all pages that output HTML.[/li]
[li]You are going to have a problem with your checkboxes. You have four checkboxes with the same name. While many online resources will demonstrate doing this, it is almost always the wrong approach. The problem is that if a user checks all of the boxes (the same point exists for two or more), your form will only receive the value for the last one that was checked. In this case, business. You can fix this a couple of different ways. The first is to give each checkbox a different name. This works, but isn’t the best choice for forms with groups of checkboxes. There is a better alternative: make an array out of the checked boxes. To do this you simply need to add “[]” to the end of the name. So if your boxes were previously named “subjects” you would simply rename them to “subjects[]”.[/li][li]Lastly, your submit and reset button inputs should have some double quotes added. They should work with most browsers the way they are, but you definitely should add the quotes. I’ll let you try to figure out where.[/li][/ul]
Your webinfo.php page needs a lot of work. It looks like you copy and pasted a previous assignment as something of a template, but in this case, I would really start from scratch. The opening HTML is very problematic:[code]
LINK SHARING WEBSITE
[/code]
Note that you have an empty head section, an opening body tag, another complete head section inside the body, then finally another opening body tag. This will need to be cleaned up to have one and only one head followed by one body.
Your title and menu section is identical to your form. The menu is fine, if you really want to have is on this page, but I would change the title to something more indicative of the page’s purpose.
You mentioned that you were only successful in getting the form’s homepage and email. Take a look at your form and see what the other element names are. You can get these the exact same way you are the homepage and email. It should be noted that if you follow my recommendation above regarding the checkboxes, your checkbox value will be an array, not a string.
Your code has two entire sections that are unrelated to the given assignment. There is nothing about saving the information to a file, or sending an email. There is; however, a requirement to use mySQLi to collect and store the information.
I will be happy to help you with your mySQLi requirements, but I need for you to come up with an initial effort, since this is for an assignment. This is a two step process. The first is to create a table in your database to store the information in. Most of the columns should be pretty obvious; however, you may run into some difficulty with the checkboxes.
Without saying which is best for this application, there are a couple of possibilities:
[ul][li]Create a separate column for each checkbox. You could use nearly any datatype in this scenario, some are definitely better than others.[/li][li]You could also implode the array and store the string in a single column. You would then explode it back into an array upon retrieval. There are more sophisticated ways of doing this, such as to serialize the array, but a more basic approach seems more appropriate for the situation.[/li][/ul]
A couple of other suggestions:
When you work on the mySQLi, you will need to have a username, password, database name, and table name. MAKE SURE YOU OBFUSCATE THE USERNAME AND PASSWORD IN YOUR CODE BEFORE POSTING IT. Most people put the connect string in a separate file and use an include, but that may be outside of what you are expected to do.
Lastly, if is much better if you use the php button in the formatting section when you are posting php code to the forum. You click the php button and insert your code between the tags that it creates. You should repeat this for each section of php that you are pasting. If you look at your original message, it is rather difficult to see that it is two different files with a non-code related comment (“Below is the php script to collect information:” sandwiched in between. By using the php feature, the code is neatly formatted in a scrollable box, making it much easier for us to follow.
You are off to a good start. As I said, I will gladly help you get through this project, but I want to make sure you are learning from it as well. Try making some changes based on the above then when you get stuck, post what you have and the issues you are having. It might take a few tries, but I have no doubt you’ll put it together just fine.
Jay