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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:00:50+00:00 2026-06-17T12:00:50+00:00

I am an amateur web developer and I am developing an application that mainly

  • 0

I am an amateur web developer and I am developing an application that mainly uses JavaScript but needs to use PHP/MySQL because it is a quiz application and I don’t want people to see all the quiz answers by going to “View Source.” The pages of relevance are: index.html, problems.php, functions.js. The index.html is the main quiz page. The problems.php is the page used to connect to the server and get the answers to the questions on the quiz page. And the functions.js is used to check whether the answers are correct among other things that prompt the app to do something.

index.html:

<?php
    include ("problems.php");                                    
?>
...

problems.php

<?php
    // Connect to server
    $con = mysql_connect("XXXXXXXXXXXXX", "XXXXXXXXXXX", "XXXXXXXXXXXX");
    mysql_select_db("problems", $con);
    if (!$con) {
         die("Didn't connect");
    }
    $question_num = $_GET["num"];
    $sql = "SELECT question FROM questions WHERE num='" . $question_num . "';";
    $answer = mysql_fetch_array(mysql_query($sql))['question'];
?>

functions.js

function checkAnswer(ans, input) {
    if (ans == input) {
        alert("Correct!");
    }
}

I am not a PHP developer and know very little PHP (which is why I’m choosing to use JavaScript for the application). But I would like to use the GET method in getting the answers to the quiz questions (when the user clicks “Submit” pass in ?num=1,2,3,4,5). Then pass in the quiz answers obtained from the database to the functions.js checkAnswer function to check the answer. My problem is the pass in the answers to the questions to the functions in JavaScript. Also, it doesn’t seem my server is even connecting to the database in my code.

  • 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-17T12:00:52+00:00Added an answer on June 17, 2026 at 12:00 pm

    You can achieve this as follows

    Steps

    1. Pass the question ID and answer entered by user to a PHP page
    2. Validate the answer on the php page
    3. Then return true/false based on the answer

    I will suggest you to use jQuery ajax for this

    $.ajax({
       url: "GetAnswerStatus.PHP?questionid=4&input=3"
    }).done(function ( data ) {
       // data = true/ false
       console.log("Answer:" + data);
    });
    

    Or use jQuery .get

    $.get('GetAnswerStatus.PHP?questionid=4&input=3', function(data) {
        console.log("Answer:" + data);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a web application with PHP and MySQL. I have an entity
Forgive my amateur coding, but I've smashed together a crude page that uses jQuery
I'm an amateur web developer and I would like to know how to create
I am not a professional web developer, but I like to wrench on websites
i am an amateur website developer and am not that informed on the differences
I'm an amateur developer and I'm creating an Android app that will perform long
Amateur rails programmer struggling to use the fields_for form builder. My rails application (on
Overreaching amateur developer that is outsourcing some of my work and doing part of
maybe this sounds silly... but as an amateur android developer, i want to know
I am developing a WPF Application using MVVM Architecture. I am an amateur in

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.