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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:25:10+00:00 2026-06-06T11:25:10+00:00

I’m creating a webpage which has several fields. I do not want the php

  • 0

I’m creating a webpage which has several fields. I do not want the php code to execute unless all the fields are filled out as that will create an error.

Here is my html code:

 <html>
 <body bgcolor="AliceBlue">


<form action="WorkingVersionV2.php" method="post">
<p>Which database do you wish to access? <center> <input type="text" name="database"/>     </center></p>
<p>What table would you like to examine? <center><input type="text" name="oldtablename"/></center></p>
<p>What would you like to name the table produced? <center><input type="text" name="newtablename"/></center></p>
<p>Start at row: <center><input type="text" name="startrow"/></center></p>
<p>Number of rows to search through:<center> <input type="text" name="numberrows"/>     </center></p>
<center><input type = "submit" onclick="checkFields()"/></center>
</form>

<script type="text/javascript">
function checkFields()
{
    var x = document.getElementById("database").innerHTML;
    if(x=="")
   {
        alert("You forgot to enter a database name");
       }
}
</script>

</body>
</html>

I figured throwing a pop up box would halt the user if the fields were not filled out. However, when the user clicks submit, the pop up box is not thrown up, and I’m unsure whether the php code will still execute once they close it.

HTML/javascript is not my forte, if you have a better or easier way of doing this then please let me know.

  • 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-06T11:25:13+00:00Added an answer on June 6, 2026 at 11:25 am

    If you are using the input type=submit for non-javascript browsers then you need to make a few changes.

    You javascript function needs to return a value like this:

    <script type="text/javascript">
    function checkFields()
    {
        var x = document.getElementById("database").innerHTML;
        if(x=="")
        {
            alert("You forgot to enter a database name");
            return false;
        }
        return true;
    }
    </script>
    

    And you should change your input button like so:

    <input type="submit" onclick="return checkFields();" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has

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.