Hello DPs, I need some help with my PHP form. I am trying to make a form that submits to my email but also, if they check naughty or nice checkbox they will be redirected to either naughty or nice whichever one they choose. Though I keep getting an error message when i click submit. My index.php http://pastebin.com/jEWzFVZL send.php http://pastebin.com/vgcx6FnH Cant wait to here your input, and learn a little more!
Okay. First things first: throw away that code, and start over. You have so many things wrong in that index-file that it hurts my eyes. Tables for form-layout? Really? No proper structure either - they´re called "labels" - look it up. Since you´re not saying what kind of error you´re getting, it´s almost impossible to help - but for the redirect, you´re not actually redirecting, you´re echoing out stuff - I´m not sure if that´s intentional or not?
@PoPSiCLe has it right, the HTML for that ALONE screams "I don't know what a form is" as you've got no labels, no fieldsets, and WORSE that's not tables for layout, that's tables for NOTHING!!! If there's only TD, and there's only one TD per TR, there is NO reason to EVER use a table!!! Though your REAL problem? In your markup you have these two input: <input type="checkbox" name="list[]" value="Naughty"> <input type="checkbox" name="list[]" value="Nice"> You seem to be trying to access those as: $_POST['checkbox'] When those would not make a $_POST['checkbox'], they'd be making $_POST['list']... To get what you want server-side those input should be: <input type="checkbox" name="checkbox[Naughty]"> <input type="checkbox" name="checkbox[Nice]"> They don't even actually need a value as they will either exist or not exist in the resulting $_POST['checkbox'] array.
Oh wow, my bad didnt mean to offend you. Ill jjst throw it away and retry i guess, i just didnt want to use someone elses work for a form, was trying to create my own. This was the error i was getting "Parse error: syntax error, unexpected T_STRING in /hermes/bosweb26b/b1807/ipg.stmcevoy/Santa/send.php on line 23"
The guy had a specific question so instead of answering it we berate his experience and his attempt at learning then go on an offbeat tangent about the validation of his HTML code because it isn't up to standard or your standards????? Try answering his question first then if you want to assist him with his HTML code then do so maturely.
First off, @macstux, you didn't offend -- it's just we see the same mistakes over and over and over again -- through faulty learning, through blind copypasta of other people's works, and because a lot of the people teaching and writing tutorials really have zero business doing so. We all start somewhere, I was writing code like what you have now back in '98 before I took the time to understand what HTML is, what it is for, and what the tags MEAN.
@deathshadow can be a bit harsh sometimes but at the same time you gotta see it for what it is. If you go to a mechanics forum and say some thing stupid they would ridicule you the same. Outdated code should be shunned. I do think that sometimes text can appear insulting but it is really taken out of context. Typing something and saying something can come out completely different. In most cases such as this one he actually did tell the OP ways to accomplish the goal after the supposed hate talk. I too have felt insulted by deathshadow before when I did something stupid. But that just means that he cares . If he did not care he would just encourage bafoonery.