Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8940879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:09:38+00:00 2026-06-15T11:09:38+00:00

PHP Form select & radio error I have a form, but I got php

  • 0

PHP Form select & radio error
I have a form, but I got php error on select button and radio button
the error I got are $age and $gender

how to print error message in same page?

here is php code

$firstname="";  $lastname="";   $email="";  $re_email="";

if(isset($_POST['register'])){
    $firstname=strip_tags($_POST['firstname']);
    $lastname=strip_tags($_POST['lastname']);
    $email=strip_tags(strtolower($_POST['email']));
    $re_email=strip_tags(strtolower($_POST['re_email']));
    $password=strip_tags($_POST['password']);
    $re_password=strip_tags($_POST['re_password']);
    $age=$_POST['age'];
    $gender=$_POST['gender'];
    $date=date("Y-m-d");

    if($firstname && $lastname && $email && $re_email && $password && $re_password && $age && $gender){}
    else{die("Please fill in all fields");}

    //USERNAME CHECKING//////////////////////////////////////////////////////////////////
    $connect=mysql_connect("localhost", "root", "");
    $database=mysql_select_db("phplogin", $connect);
    $namecheck=mysql_query("SELECT email FROM users WHERE email='$email'");
    $count=mysql_num_rows($namecheck);
    if($count!=0)
    {die("Username already taken");}

here are Html code

<html>
<H1>Register</H1>
    <form action="register.php" method="POST">
    <table>
        <tr>
            <td>First Name:</td>
            <td><input type="text" name="firstname" value="<?PHP echo $firstname;?>" maxlength="25"/></td>
            <td>Maxium 25 characters</td>
        </tr>

        <tr>
            <td>Last Name:</td>
            <td><input type="text" name="lastname" value="<?PHP echo $lastname;?>"maxlength="25"/></td>
            <td>Maxium 25 characters</td>
        </tr>

        <tr>
            <td>email:</td>
            <td><input type="text" name="email" value="<?PHP echo $email;?>"maxlength="40"/></td>
            <td>Maxium 40 characters</td>
        </tr>

        <tr>
            <td>Re-enter email:</td>
            <td><input type="text" name="re_email" value="<?PHP echo $re_email;?>"maxlength="40"/></td>
        </tr>

        <tr>
            <td>Password:</td>
            <td><input type="password" name="password" maxlength="25"/></td>
            <td>Password must be between 6 and 25 characters</td>
        </tr>

        <tr>
            <td>Re-eneter Password:</td>
            <td><input type="password" name="re_password" maxlength="50"/></td>
        </tr>
    </table>
    <select>
            <option value="">Age</option>
            <option name="age" value="18-29">18-29</option>
            <option name="age" value="30-39">30-39</option>
            <option name="age" value="40-49">40-49</option>
            <option name="age" value="50-59">50-59</option>
            <option name="age" value="60-69">60-69</option>
            <option name="age" value="70">70 Plus</option>
        </select>
        <input type="radio" name="gender" value="male" />Male
        <input type="radio" name="gender" value="female" />Female
    <input type="submit" name="register" value="Register" />
    </form>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:09:40+00:00Added an answer on June 15, 2026 at 11:09 am

    To enable error reporting, add to your page:

    ini_set('display_errors',1); 
    error_reporting(E_ALL);
    

    To allow error reporting to all pages, add to php.ini:

    error_reporting  =  E_ALL
    display_errors = On
    

    and restart the Apache service.

    Change toy select to :

    <select name="age">
         <option value="18-29">18-29</option>
         <option value="30-39">30-39</option>
         <option value="40-49">40-49</option>
         <option value="50-59">50-59</option>
         <option value="60-69">60-69</option>
         <option value="70">70 Plus</option>
     </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a select box with these values: <form action=ampcontrols.php method=post name=amp> <select name=amp>
I have created a PHP form which requires the user to select a postcode
I have a form that looks like this. <form action=index.php method=post> <select name=dropdownOption> <option
I have a group of radio buttons in a multiple select quiz form and
i wrote in file showList.php the following form, which select items from the database
I load a form and dynamically populate a select via AJAX from a PHP
With PHP I echo out a <select> with options to a form based on
I have a basic PHP form (a few fields and 2 checkboxes, I want
I have a php form which saves these values to the database: id rand
I have a PHP form with 4 text fields and 2 checkboxes. The checkboxes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.