I don't know PHP at all. I am self teaching myself, and not even from a tutorial; just from examples from my script. However, there are a couple things I need to know if anybody could please help! You know in registration, when they ask if you are "male" or "female" and you have like a little circle where you can click if your either. What's the code for that? Oh and, for the boxes...when you have many options and they can click more than one. Those boxes... Thanks!!!
Sounds more like you need to learn HTML. The first is called radio and the second is called... checkboxes. Both are types of input tags in HTML. Here is a tutorial which covers both: http://www.w3schools.com/html/html_forms.asp
Your Sex?<br /> Male <input type="radio" name="gender" value="Male"/> Female <input type="radio" name="gender" value="Female"/> Then you can get that info in php by using this, $gender = $_POST['gender']; echo $gender;
Thanks!!! Very helpful both the guide and the code. A couple of questions though, 1st...I can't use the same variable in other pages, right? I mean I have to put them there so they work there, right? And most important...you know when you register and in some websites when they ask you for country and you put US, and (sometimes reloads, others just appears) another box appears to input the state. How do you do that? I tried using the "if" statement, but I don't know exactly how it is.
If you don't want the page to reload it would require javascript. Here's yet another tutorial: http://www.plus2net.com/javascript_tutorial/dropdown-list.php
Thanks again! One last question....about the checkboxes....do you know how to make it so that people can choose up to only, for example, 10 options, and at least 5? I've been looking through the tutorial, but couldn't find it
In regards to the last question: You could limit it in PHP (And throw an error if too many or too little were selected), however it would probably be best to use Javascript for this. Try the javascript forum.
Thanks! Yeah, I know...I have a few errors in my code, but it ia only for when they don't put information. I knwo if you use "!" before the variable, that's how the error works. What code you need to use to limit though? And why would Java be better? Thanks again!
Javascript would be better because it would check before they submitted the page. PHP would check as its processed and would have to redirect back to the form. You would have to count the options for the checkbox and do a check if it was over the limit. like $limit = 5; if($totalCheckboxes >$limit) { error out} else { go } Best bet would be to check into using javascript and let php handle success only.
Well I did a search and found this site: http://particletree.com/features/a-guide-to-unobtrusive-javascript-validation/ I have seen that authors name before with quality stuff but he might be a little bit complicated. Or you could try this one: http://www.elated.com/articles/form-validation-with-javascript/ This search phrase : Javascript Validation forms : returns lots of hits at google. Good luck