Welcome! Log In Create A New Profile

Advanced

Stuck - manipulating database via browser

Posted by Anonymous User 
Announcements Last Post
Announcement : Programming Students at UNISA School of Computing 06/19/2019 02:01PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Anonymous User
Stuck - manipulating database via browser
October 09, 2008 10:46AM
Somehow I am stuck now. I know there is an error in my thinking but I do not come out:
Entering data via a form and the data is recorded in a MySQL database

When looking at Apply your knowledge 6-2 on page 84 I find two files 'add-record_form.php' and 'via_browser.php'. Now I come to the problem in the final prac: whenever I enter data in my studentregistration form via the browser there is only a new record added to the database 'registration' - table 'student'- yes a new student no. is given since this is the primary key but the other fields remain empty. When I enter the data which I entered in the form now in the second file like 'via_browser.php' then the fields are filled with those data. But this would make no sense since the database should be automatically filled when entering data in the form fields without involving another php file.
So, there must be something wrong in my thinking but I cannot figure it out.
Hope I could be clear enough...
Does anybody has an idea?
Greetings from foggy Germany
Iris
avatar
Mac
Re: Stuck - manipulating database via browser
October 09, 2008 12:15PM
You have a form where the student enters his information.

The information gathered from this form is sent to another file, or (preferably) to the same file, in which case you will make use of something like this:

if($submit=='register'){
//then manipulate data e.g. add it to the database using sql queries
}
else
{
//show the registration form
}

Just make sure that you catch the variables that was sent with the form.
Anonymous User
Re: Stuck - manipulating database via browser
October 09, 2008 06:34PM
Mac,
Thanks for your prompt response - now I could solve the problem.

Just one other question:
In your project information you indicate 'Course name' as the first field in the student registration form. I am just wondering because this field is not in the student table but in the course table.
Hence we have to insert data into both DBs 'student' and 'course', right? I am not sure about the statement [(RP 1 Collect course name) from the database] in your project information - for what purpose should the course name be collected?

Thanks in advance for your support.

Regards,
Iris
avatar
Mac
Re: Stuck - manipulating database via browser
October 10, 2008 07:10AM
All information gathered in a form is not necessarily saved into one table.

The courses I could register for should be presented in a drop down list - you don't want me to type the course name do you eye popping smiley ???

So in one form I could draw information for drop-downs from many tables (or db's, for that matter), depending on what I need.
Anonymous User
Re: Stuck - manipulating database via browser
October 10, 2008 11:38AM
Alright Mac I do understand.

But can you type the course name....tongue sticking out smiley

....no, just a joke!grinning smiley

Have a nice weekend!

Regards,
Iris
Sorry, only registered users may post in this forum.

Click here to login