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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:00:33+00:00 2026-06-01T02:00:33+00:00

Basically i have a form where a studentID is inputted, i then want to

  • 0

Basically i have a form where a studentID is inputted, i then want to check id the inputted studentID is in the database, if it is post the form to the next page. If not then display an error on the page where you input studentID

Don’t really know where to start
Cheers

  • 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-01T02:00:35+00:00Added an answer on June 1, 2026 at 2:00 am

    is this what you want?

    <form id = "form" action = "./?page=markandfeedback" method = "post"> 
    
        <br>
        Mark for:
    <INPUT id="stud" onkeypress="return isNumberKey(event)" type="text" name="stud"  value="Enter Student Number">
    <input type="submit" value = 'Continue'>
    <?
    
    $studID = $_POST['stud'];
    $module2 = $_SESSION['module'];
    $ex = $_POST['exer'];
    $studerr = array();
    
    $sql = 'SELECT * FROM `student`, `modules` WHERE `studentID` = '.$studID.' AND `moduleCode` = '.$_SESSION['module'];
    $result = mysql_query ($sql);
    //    echo $_SESSION['module'];
    
    if ($result == NULL) { // nothing found
    echo "the student id you entered is not in the database";
    }
    else {
    
    
    $_SESSION['student'] = $studID;
    
    Header("Location: http://www.whereever.com/"); // send the browser where you want
    exit();
    }
    ?>
    

    EDIT:
    I went over the other answers. I assume you check for mysql injection properly. I recommend implementing AJAX AFTER everything works and is secure. The idea behind my solution was to solve the problem as simple as possible. If you want to make something fancy out of it you could:

    • generate the whole form via php and tell the user in the input field, that the id wasn’t found
    • tell your Javascript to present the information in some fancy way
    • Use AJAX. Everybody loves forms with AJAX.
    • You could, as suggested, assume that the user entered a valid id. You would check on the “whereever” page wether the id is actually valid. If it weren’t, you would simply send the user back to the form and tell the php to output an error message (maybe via get). This possibility is not usual, I am not sure if it has any advantages.

    the mysql_num_rows hint is nice, too, if you don’t want any data from the user. I thought you wanted to do something with the data because of the SELECT *.

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

Sidebar

Related Questions

I have this form. Basically what I want is to send a auto-response with
I have to design a database to handle forms. Basically, a form needs to
I have a page that is definitely not a form but I need to
I basically have a page which shows a processing screen which has been flushed
I want to change the default error messages being thrown by Spring. I basically
I have the following code. def add_resume_link(name, form) link_to_function name do |page| html =
I basically have a form inside of Flash that I need to submit to
I have a form on my screen with a reportviewer control. I want to
hopefully will explain this right! Ok, Basically I have a form within my sitecore
yesHave a simple thing here, but not that handy in PHP. Basically I have

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.