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 6155853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:30:34+00:00 2026-05-23T20:30:34+00:00

I realize it’s impossible to prevent someone from changing the names of input elements

  • 0

I realize it’s impossible to prevent someone from changing the names of input elements in firebug.

How should I approach this problem? A user changes the name of the input element “firstname” to “month” and visa versa.

<form action="example.php" method="post" enctype="multipart/form-data">
    <table  border='2'>
        <tr>
            <td>
                First name: <input type="text" name="firstname" /><br />
            </td>
        </tr>
        <tr>
            <td>
                Last name: <input type="text" name="lastname" /><br />
            </td>
        </tr>
        <tr>
            <td>Birth Month:
                <select name="month">
                    <option value="01">January</option>
                    <option value="02">February</option>
                    <option value="03">March</option>
                    <option value="04">April</option>
                    <option value="05">May</option>
                    <option value="06">June</option>
                    <option value="07">July</option>
                    <option value="08">August</option>
                    <option value="09">September</option>
                    <option value="10">October</option>
                    <option value="11">November</option>
                    <option value="12">December</option>
                </select>
                <br />
            </td>   
        </tr>
        <tr>
            <td><input type="submit" name="Submit" value="Sign Up!" /></td>
        </tr>
    </table>
</form>

My best idea so far is:

<?php
$month= $_POST['month'];
if($month!= 01 || $month!= 02 ... $month!= 12)
    echo 'wrong month';
?>

However this won’t be clean for the year of birth… Facebook does a great job of preventing this when you sign up but I wasn’t able to figure out what they did. A non-javascript solution would be much appreciated.

EDIT: Lawrence, what do you recommend for a location form?

  • 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-05-23T20:30:35+00:00Added an answer on May 23, 2026 at 8:30 pm

    Going through each month in a condition is unneeded, php has functions for that.

    <?php
    $firstname= (string)$_POST['firstname'];
    $lastname = (string)$_POST['lastname'];
    $month    = $_POST['month'];
    
    if(in_array($month,range(01,12))===true){
        $cont = TRUE;
    }else{
        $cont = FALSE;
    }
    //If set, not empty, not swapped for month & greater or equals to 6 chars 
    if(isset($firstname) && $firstname!="" && strlen($firstname) >=6 && in_array($month,range(01,12))===false){
        $cont = TRUE;
    }
    //If set, not empty, not swapped for month & greater or equals to 6 chars
    if(isset($lastname) && $lastname!="" && strlen($lastname) >=6 && in_array($month,range(01,12))===false){
        $cont = TRUE;
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize this may be a simple problem, but I am new to ASP.net
I realize this may be a reproduce of a question from '09 OLD LINK
I realize this isn't terrific from a security perspective but humor me. Is there
I realize there are similar questions on this topic, but I still cannot find
I realize this is more of a hardware question, but this is also very
I realize that the answer to this question is likely quite obvious (if somewhat
I realize this comes at an enormous risk of being branded subjective and discussion-based,
I realize that this question has been asked 100times but none that I have
I realize this is a rather odd request, but I was wondering if anyone
I realize this is probably a hopelessly newbie question, but what is the difference

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.