Search the Community
Showing results for tags 'radio button issue'.
-
ok so i started off with a radio button well two radio buttons to be exact, and i keep on having this issue but i check to make sure i didnt misspelled anything and so on but i still getting this same problem, also when i click on the one of the radio buttons it works heres the error Notice: Undefined index: position in D:\wamp\www\Website\admin\testing.php on line 65 and this is the code for the above issue if(isset($_POST['submit'])){ // define the variables $Title = $_POST['title']; $Detail = $_POST['description']; $Position = $_POST['position']; echo $Position; // define the error too $errors = array(); // now sanitized please $Title = strip_tags(trim($Title)); $Detail = strip_tags(trim($Detail)); $Title = preg_match("/^[a-zA-Z0-9]*$/", $Title); $Detail = preg_match("/^[a-zA-Z0-9]*$/", $Detail); // now lets see if its empty if(empty($Title) && empty($Detail) && empty($Position)){ $errors[] = 'All Fields Are Required'; } foreach($errors as $error){ echo $error; } } echo '<form action="testing.php" method="POST" enctype="multipart/form-data"> <input type="text" name="title" value=""> <textarea name="description" col="8" row="24"></textarea> <input type="radio" name="position" value="a">Main Position <input type="radio" name="position" value="b">Second Position <input type="submit" name="submit" value="Save"> </form>'; any tip or advice on this one?