Welcome! Log In Create A New Profile

Advanced

New prac thread

Posted by Mac 
Announcements Last Post
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
Re: New prac thread
June 01, 2006 10:40AM
Hi All

Im struggling with some things.

Problem 1:

Page one the new student inputs his details into a page in the text boxes.
The information is tranfered to page 2 by Form method =post action ....
Page 2 picks up the information and displays it all in a HTML table for the end user to confirm if its correct. Making use of the @extract($_POST).
At the bottom of the page I have 1 hyperlink to go back and button to accept the information.

My problem 1.1 is how to i pull the information now into the page 3 to insert the database.

My problem 1.2 is if the end user clicks the back hyperlink, how can i leave all the users information their, at the moment the end user has to retype it all.

Problem 2:

I have developed a page 1 that the student can input his student number and his records will be displayed in a HTML table with editable text box. Next to each record displayed, i want to put either a hyperlink or a button so that the student can click to edit. Can I bundle the update command mysql into a hyper link or in a button, and how would i do that. I can even allow the end user to update his records and click only on a hyperlink or button at the end of the page to update the records.
Re: New prac thread
June 01, 2006 02:42PM
Edward
1.1 one option would be to store all the data in hidden fields, or put them into an array.

1.2 The HTML input field has a value attribute which you can assign.

2 I let the user edit all the fields and then I save them all in the same way I saved the data the first time round.
Re: New prac thread
June 01, 2006 02:45PM
I am busy with the list of students registered for each course.

I have a table where all of the courses in the database are listed.

When you click on the course name, another table is generated whereby the students registered for that particular course should be listed.

My problem is this:

I keep on getting an error message that there are no students registered, but if one uses mysql_num_rows() the number of rows returned is the number of students in my database.

I have joined my tables, and when I run the query through phpmyadmin, a table is produced that gives me the result that I am looking for.

For some reason, I am struggling to get the information from my joined table into a php table.
avatar
Mac
Re: New prac thread
June 01, 2006 04:22PM
edward
1.1 One way is to use a form with hidden fields e.g
<input type="hidden" name="sname" value'<?php echo $sname"; ?> etc.

1.2 You can use sessions which requires a few minor changes to your 1st page form.
<input type="text" name="sname" value'<?php echo $sname"; ?> etc.

Or ask them to use the back browser back button.

Or just add all the variables to the <a href string, as in <a href="first_page.php?<?php echo "sname=$sname&fname=fname...etc ?>Go Back</a> then use the form changes e.g.

<input type="text" name="sname" value'<?php echo $sname"; ?> etc.

Wayne

Why use a join? You have the course name already on its own, so a join is not necessary.

//db connect and query code etc here
{ //loop here
//get name and id of course $row=['id'] or whatver you use
echo <a href=page.php?cid=$cid>$Course</a> (in a table if you want)
} //end loop

From here, clicking the link takes you to the page that, using a single query and the course id, gets the students from the student_course db

select from student_course where cid="$cid".....

//loop through names and present in a table.


Re: New prac thread
June 02, 2006 12:33PM
OK I finally found the reason why the footer.php file was messing up the entire form


well the comments in the footer.php file were not ended off correctly.

all working well now
Re: New prac thread
June 02, 2006 05:38PM
Mac thanks,

As the old adage goes:

"The simplest solution is normally the correct one"

Now:

When I click on a course id, the students registered for that particular course are listed.

What I want it to do is have their first names and surnames listed alongside their student numbers, which is not happening at the moment.

I will solve this soon enough though.

Re: New prac thread
June 03, 2006 08:27PM
Sorry for my long period of silence. I have been having a few issues with my ISP.

I seem to have missed a lot. I just have 3 questions though.

1. I see the submission date has been shifted to 17 June. How true is this?

2. How do we submit our final projects?

3. Do we have to write some kind of report?



Thanks

Murphy's Technology Law 7
-- The attention span of a computer
is only as long as its electrical cord.
avatar
Mac
Re: New prac thread
June 04, 2006 08:44PM
1. True
2. If you have webspace on a server where the app resides and works, you can send me the URL. You alos need to send me the files. Otherwise, just send me all your files. Will give more details towards the end.
3. No
Re: New prac thread
June 05, 2006 07:02AM
Mac, for the purposes of this course, do you wish us to vailidate the data from the forms?

Also, in real world applications would we put the database connection details in an include and secure them somehow to prevent people accessing the database? I realise this is no covered by the course, but what do you suggest as the best method?
avatar
Mac
Re: New prac thread
June 05, 2006 10:57AM
No validation required - and strange that you ask it now (see last link here below why I say this - they reckom Javascript validation is more unsecure than PHP validation - not too sure about that since Javascript is not executed on the server as PHP is but on the browser-side, which is better IF your PHP code is secure). There is a lot more we can require from you - what we ask you to design is in no way a complete application, but doing a registrations system as the taks makes you intuitively think of a lot of other things that you can/should/may add. And that is valuable for us and you.

Unfortunately I cannot give you a short answer to your second question - there are just too many factors you need to consider. And no-one really can since hackers always - or eventually - find a way.

But you shouldn't help them by having the basics worng. Here are two good readable introductory answers to your question - http://www.ilovejackdaniels.com/security/writing-secure-php-2/
http://www.sitepoint.com/print/php-security-blunders

Sorry, you do not have permission to post/reply in this forum.