0

I use a mysql database with students and grades for a training program. I would like to create a dynamic form with one field that works like this: if i write the name in the form and press check, and the student exists, i want it to show me the information about the student and just one form field for the grade. if the user does not exist, i want it to output all the form fields required to insert the data for the student plus the grade field.
Is javascript the proper language for this? How can I accomplish this? I have worked only with php until now, and I have no javascript experience. Can you guide me to any tutorials with a similar approach to forms? Thank you.

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by Graphix
0

If you want the page to not reload, JavaScript is the way to go. However as you do not have experience in programming with JavaScript and the subset of JavaScript functions AJAX, I recommend you use only PHP.

When you only use PHP you need to do the following:

if (isset($_POST['set_grade_subm'])) {
 // Process the set-grade form
} else {
 if (isset($_POST['student_id'])) {
  // Show the form which allows you to change the grade
 } else {
  // Retrieve all students from the database and all give them a checkbox with the value of their ID
  // Put those in a form with a submit button below it
 }
}

The form needs to have the following fields (their names):

- student_id, containing the student id (hidden input)
- new_grade, containing the student grade (textbox)
- set_grade_subm, submit button

If you do not have alot of PHP-experience I would suggest you read through some guides online (http://tizag.com/ , http://www.w3schools.com ) or read a book about PHP & MySQL (for example PHP & MySQL for Dummies, and if you are a bit further than that PHP Advanced: Quickpro guide by Larry Ullman).

~G

Edited by Graphix: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.