A very simple code.. but totally cant google for help.

[size=14pt]Greetings,
A short introduction before i ask a few questions,
I am a IT Student in Singapore, have learn python, Java and now php/html codes.
And no, i am not an expert on all these… its too much of stress for me to take all in a go.

Currently i am doing a simple project for my school (Final Year Project), a team of 3 students (Including me), it is really VERY VERY VERY Important, and i am stuck. Guess what i cant even approach help to my teachers, and i have no choice left.

I have tried to self learn a few codes. Manage to get some working and some not. I’ll make it short summary about what are the requirements of this project.

Project Category: Online Helpdesk

Included:

[ul][li]Showing Ad-Hoc messages
FAQ Links
Login/Register (I need to create a Master Data for registering as to identify a Student or Staff)
Create/Submit Tickets
Status of Tickets [/li]
[li][/li][/ul]

And more.

There is more but however right now i am stuck at Registration

This code below is just a simple Register form.
[php]
Order Form

* - Mandatory fields

            <label for='idName'>Name</label><font color='red'>*</font>: <input name="fullName" type="text" id='idName' required placeholder='Full Name' /><br/><br/>
            <label for='id'> ID</label><font color='red'>*will be use for login</font>: <input type='text' name='id'  id='id'  placeholder='e.g: 13012345' size='8' maxlength='8'  /><br/><br/>
        

            
            <input name="category" type="radio" value="1" hidden/> <!-- Student -->
        <input name="category" type="radio" value="2" hidden/>  <!-- Staff -->
        
        
        <label for='idEmail' >Email: </label><input name="Email" type="Email" id='idEmail' size="40" placeholder='eg: [email protected]' /><br/><br/>
                        
    
        <label for='idNumb' > Contact Number</label> <font color='red'>*</font>: <input name='phone' type='number' id='idNumb' required placeholder='e.g: 12345678' size='8' maxlength='8' value='number' />
        <br/><br/>
        
        <label for='password' >Password<font color='red'>*</font>: </label><input name="password" type="password" id='password' maxlength="15" placeholder='Max 15 Character' required /><br/><br/>
        <label for='confirmpassword' >Confirm Password<font color='red'>*</font>: </label><input name="confirmpassword" type="password" id='confirmpassword' maxlength="15" placeholder='Double Confirm?' required /><br/><br/>
        <input type='submit' value='Submit'> <input type="reset">
    
    </fieldset>[/php]

As you can see my “Category” is hidden, as i need to identify thru “ID”
Student ID starts with = “1xxxxxx”
Staff starts with = “3xxxxx”

I believe i need to do a IF ELSE statement to check my database, but have a look at my doRegister page…

[php]<?php
include “dbFunctions.php”;
$fullname = $_POST[‘fullName’];
$login_id = $_POST[‘id’];
$category = $_POST[‘category’];
$email = $_POST[‘Email’];
$phonenumber = $_POST[‘phone’];
$password = $_POST[‘password’];
$confirmpassword = $_POST[‘confirmpassword’];
$role = “”;

if ($login_id = “3%%”)

if ($category == “1”) {
$role = “Student”;

} else {
$role = “Staff”;
}

if ($fullname == “” or $email == “” or $login_id == “”
or $phonenumber == “” or $password == “” or $confirmpassword == “” or $category == “”) {
$message = "There was an empty field, please refill the form.
Back
";
} else {
$queryCheck = “SELECT * FROM user WHERE login_id=’$login_id’”;

//echo $query_check;
$resultCheck = mysqli_query($link, $queryCheck) or die(mysqli_error($link));

if ($password == $confirmpassword){
//All good. Carry On.
}else{
    echo "Sorry your passwords do not match. <br /> <a href='Register.php'>Back</a> <br/>";
    exit();
 }

}

if(mysqli_num_rows($resultCheck) == 1){
    $message = "ID already exist";
    $message .= "<br/> Please <a href='Register.php'>register</a> again";
}else{
    $queryInsert = "INSERT INTO `user` 
            (`name`, `password`, `login_id`, `email_adress`, `phone_number`, `Role_role id`)
             VALUES
             ( '$fullname', '$password', '$login_id', '$email', '$phonenumber', '$category')";
                 
                 $resultInsert = mysqli_query($link, $queryInsert) or die(mysqli_error($link));
                 $message = "Hi" . " " . strtolower($fullname) . " , you has been registered as" . " " . $role;
                 $message .= "<br/> You can now <a href='index.php'>login</a>";
                 mysqli_close($link);

}

?>[/php]

This was what i did to get it connected and insert in my localhost Database.
As i mention a Master_Data i need to create in my database, filling it up with existing Sample of Student ID, and Staff ID.

Under TABLE User will be empty, and doRegister.php will be inserted in USER.
I create a ROLE TABLE and categorize Student = 1, Staff = 2

NOW I am stuck here, as for my Register page, when someone enters a ID, it needs to be checked in my MASTER_DATA to check if exist DURING the register page.

THEN so can proceed the register page.

This project of mine it is really very simple… but i am really too stress and getting desperate asking for help.
I hope someone can be nice enough to support me, maybe thru skype or something.

Need help badly![/size]

NOTE: Below here is the FULL Summary of my project requirement. Its really very very very simple. It is not necessary to read it all but i put here anyways.

System home page will be able to provide the follow features: 1) Support posting of ad-hoc messages from the helpdesk team (e.g. production service interruptions) 2) FAQ link for user to search by topic or system (e.g. LEO, OASIS) 3) Start point for user to submit or view the tickets

Staff and Students:

  1. All users are required to register with the system, and their registration will be validated according to the Master table in RP to identify the “Staff and Students” 
    
  2. Each user can create and submit an enquiry form to IT helpdesk for assignment and resolution.
    
  3. There should be individual sections in each ticket for the requestor and IT helpdesk staff to update.  The name of the user and date/time should be recorded for any new comment made. All previous comments cannot be maintained or deleted.
    
  4. The problem Ticket form will contain the following details for requester: Ticket No (system auto generation), Created on, Status (submit/ pending/closed), requester information (name, staff/student, school, contact no), problem description (Subject, System name, problem description) 
    
  5. Once the problem ticket is submitted, email notification will be sent to the respective support staffs according to system name in the ticket.   
    

Helpdesk Administrator:

  1. Admin is to maintain the support staff list for all the IT system. For example, System Name 1st Support 2nd Support 3rd Support LEO Simon Smith Andy Wilts Andrew Cummings OASIS Frank Black Lim Eds Wilson Williams
  2. System auto assign the problem tickets to the available staff according to the above support matrix and leave calendar. E.g. If 1st support is on leave, then system will check the 2nd support’s availability.
  3. Ad-hoc message and FAQ list can be maintained in the system home page
  4. Admin is able to view all the problem ticket and their status.

IT Helpdesk Staff:

  1. IT staff need to create and update their leave information in the shared calendar for ticket auto assignment. 
    
  2. IT Support staff is required to login the system and change the ticket status from “Submit” to “Pending” after he or she receives the email.     
    
  3. IT Support staff to change the ticket status to “closed” once resolution is filled up
    
  4. No update is allowed once ticket is closed. 
    

Deliverables: A working application as described in Project Description

You have a user id or a ticket id (Not exactly sure what you mean) that is unique to the student (user), all I would do is have that be the part (the id) of you database table structure. What I mean by that is have the id be the primary index and have it auto increment, that way you don’t have to worry about that portion of it. Think of it as someone going up to the counter, picking a number and waiting for that number to be called. The only difference is you’re assigning the user’s info or pointing to the user’s info. There are other issues that I’m sure others will help you on, for it does look like you’re showing effort. I hope this assignment isn’t due tomorrow. 8)

Yes, Strider64, hopefully they have more time than today…

One comment on your code. I agree with using the auto-increment ID number for all users. It is the best
way to use as a pointer in other pages. The problem is that you can not set the first number to 1 or 3.
My suggestion is that you add a field to your user’s table and call it a name indicating the user level.
Most user’s tables include a user level which indicates what type of user they are. Just as you would have
fields for First-Name, Last-Name, email address, mailing address and other needed info, you would also
add a field called “user_level” or “user_permission_level” or some other field name that indicates who the
user is. In your case a simple “1” or “3”. But, since your current ID is set up as 1xxxxx or 3xxxxx, why do
you even need this field. Just use the ID number itself. You can use a simple test (IF clause) to see if the
ID starts with 1 or 3. You can use the PHP substr function to pull out the first number and compare it.

The hidden fields for these are of no use. You should use the database and pull the level of the user from it.
Hidden fields can not change. They are also viewable by anyone who views the source of the page so it can
give a hacker a little info about your system. (No really a security issue, but, better safe than sorry…)

There is an online site that I suggest to poster’s on this site that is extremely helpful for beginners. Here is
the link to it. As you will see, you can select any programming language across the top and detailed areas
of the selected language on the left. They have tutorials, although some are hard to find that walk you
thru various tasks. It might help if you get stuck on some areas and of course, post further questions here.

http://www.w3schools.com/php/func_string_substr.asp

Good luck, please post here when you get stuck again…

Either way you have an error in your script.

You can’t do

[php]if ($login_id = “3%%”)[/php]

For once there no bracked, and this code will result if (“3%%”) which is always true.

Sponsor our Newsletter | Privacy Policy | Terms of Service