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

  • SEARCH
  • Home
  • 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 8093593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:32:04+00:00 2026-06-05T20:32:04+00:00

So i have a simple form with a script to check the data before

  • 0

So i have a simple form with a script to check the data before it submits:

<form action='self.php' name='my_form' method='post' onSubmit="return checkit();">
    <select name='menu' id='menu'>
        <option value='00'>ZERO</option>
        <option value='01'>ONE</option>
    </select>
</form>

I want to have a pop up or alert box to request more information. Kinda like:

<script type="text/javascript">
function checkit()
{
    if(document.my_form.menu.value == "01")
    {
        var getColor = prompt("Enter Color: ", "enter the color");
        return false;
    }
</script>

How would I then pass the variable “getColor” to a PHP variable on submit?

Almost something like:

<?php
    $theColorIs = getColor;
?>

Is there a way to do this? I know that PHP is server side and the script isn’t, but the form has not been submitted because the script halts it. It seems like a simple thing to do, is there another option?

Thanks early for the help!!!

  • 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-05T20:32:05+00:00Added an answer on June 5, 2026 at 8:32 pm

    You can use hidden fields in your form to store the value and retrieve it through PHP

    the html form:

    <form action='self.php' name='my_form' method='post' onSubmit="return checkit();">
    <input type="hidden" value="" name="myhiddenfield" id="myhiddenfield" />
    <select name='menu' id='menu'>
    <option value='00'>ZERO</option>
    <option value='01'>ONE</option>
    </select>
    </form>
    

    the script:

    if(document.my_form.menu.value == "01")
    {
       var getColor = prompt("Enter Color: ", "enter the color");
       document.getElementById('myhiddenfield').value = getColor;
    }
    

    So when the form is submitted, the value is stored in $_POST[‘myhiddenfield’]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have a simple form like this : <form method=post name=change_pass id=change_pass action=change_pass2.php> <input
I have a simple feedback form PHP script that I would like to enhance
I have simple form like this which accepts only two values string action and
I have a simple form at my site which sends it data via Ajax
I have a simple PHP script using imagecreatefromjpeg to create a thumbnail version of
I have a php script that displays a web form to the user. When
My script is fairly simple. When someone tries to login, PHP checks the form
I have made a simple webpage to check for regular expressions. <html> <head> <script
I have a script.I will show sample. <form> <textarea id='input'></textarea> <input onclick=convert() value=go function

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.