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
The Portfolio
September 02, 2013 10:36AM
Hi everyone,

I don't know about you, but without teamwork i'm not going to complete The Portfolio in time. You've seen what Prof mac says,
we should be helping each other! So anyone who is game, or having difficulty, lets form a team and pass this together.

Lets have fun,

Charles
Re: The Portfolio
September 02, 2013 01:31PM
Hi Charles!! I am with you!! where are you in your Study material? when are you planning to start the project?

Willem
Re: The Portfolio
September 02, 2013 03:02PM
Hi Willem,

I've done most the required exercises in the Tutorials, some with good understanding and others a bit shaky . I'm going through
the recommended parts of the text book and at the same time building up the framework for what I intend using for the Portfolio.
I find I often have to refer back to the Tutorial for reference purposes. How far are you?

Charles
Re: The Portfolio
September 03, 2013 03:50PM
Hi Charles and Willem

Totally with you guys on this one. I've finished the Home & Learn, and am planning on starting with my portfolio, but I'm struggling to just get started. I've spent months learning and going over and over the work, but I don't feel like I know anything o_O
Re: The Portfolio
September 03, 2013 04:23PM
Hi All,

I will love to join you guys on this one. I've completed the tutorials and started building the Index and student registration page.
Re: The Portfolio
September 03, 2013 06:34PM
@Charles Im staring on my portfolio tonite. i have gone threw all the home&learn material. so Lets Start smiling smiley

@kiroant I know how you feel. but as soon as we using the work what we have learnt in the material provided and building a site with the code it will make more sense.
Re: The Portfolio
September 03, 2013 07:40PM
Hi All,

We all seem to be in the same position. My suggestion is that we make full use of the forum and begin with opening new topics and
discussing things,no matter how small the problem. If we get it wrong I'm sure Prof mac will step in and put us right!!

Charles.
Re: The Portfolio
September 03, 2013 08:09PM
Hi kiroant,

I know you're right and we shouldn't start to panic but so far all I've accomplished with MySQL delete, is to delete everything!
At least it works!!

Charles
Re: The Portfolio
September 03, 2013 08:27PM
Hi all

I agree, can we maybe start by looking at how this pages will work.
Re: The Portfolio
September 03, 2013 08:43PM
Hi Charles

Thanks for the giggle, I really needed it.

Input from all will be appreciated on the following:
I'm busy creating my database and have just finished working out the input types for each field.
In creating the database I started thinking about the forms which will eventually be used to populate the database with information. I have a question relating to this.
With the "address" field, should I just make this a text area on the actual registration form? If so how do I control how the information is entered by the user, for the purpose of drawing the information for future use (not that we'll have to, but if we did). Am I allowed to create multiple address lines below each other and concatenate the information to store into a single field? I know it seems like a stupid question, but I think at this rate, it's better to be safe than sorry.

-K
Re: The Portfolio
September 03, 2013 08:58PM
Hi Charles

From my side I think that for the address field we should use the multiple text field and concatenate the value. In my opinion the text area says that you can type in unlimited characters.
avatar
Mac
Re: The Portfolio
September 04, 2013 08:34AM
Generally, it is more user-friendly to provide several input fields e.g. street, city, code etc. Putting it together before inserting in the db will not help, because how will you get it out - the student information, inc address, should be editable. So here you are stuck with a single text area. If you really want to be cute you can prepend some code before each line eg xxxs is added before the street info that was submitted,and before you insert it into the db. Then search for this pattern and split it using the PHP split function. That would be silly though, because it is much easier to change the db smiling smiley Just to make you aware that there are many tricks that one can use, but it all should start with a good db design.
Re: The Portfolio
September 04, 2013 09:43AM
Thanks for clarifying Mac, that's what I thought.

If we include a log-in page, should one still be able to access the registration page even without logging in (in the case of a student as the user). I KNOW we're creating this to be viewed from an administrator's point of view, but in the tut letter it does state:

Quote

The application must provide the following minimum, essential functionalities:
1. Students can register online for one or many courses.

If you don't include a log-in page, then is it just assumed that students will also have access to this page from the public site?

- K
Re: The Portfolio
September 04, 2013 11:57AM
Hi kiroant and all,

What are your feelings on creating a topic for each page of the Portfolio??? The reason I ask this, I've noticed on my system, if I name a page index.php.
my project opens on that page. I don't know if this unique to my system, but chapter 10 states each project should have an index page. I'm intending to
use the index page as the Log in and Main menu page.

Charles
avatar
Mac
Re: The Portfolio
September 04, 2013 12:16PM
Yes, it is assumed - the point just that the same page is used by admin and students, just the entry route is different i.e. you would link to this page for students from another page.
avatar Re: The Portfolio
September 04, 2013 12:17PM
"index.php" and an "Index page" are not the same thing.

Servers load an index.php / index.html / index.asp page automatically by default, so you need to have your initial webpage named index.???.
You can overcome this by specifying the landing page in your browser url - eg www.mywebsite.com/menu.php, but most users will only enter the domain name, and therefore land on the index.??? page.


An "Index page" on your website would contain links / menus allowing users to navigate to various parts of your website.
Re: The Portfolio
September 04, 2013 01:29PM
Hi,

Thanks everyone and Prof mac, I've learnt more this morning by participating on the forum, than I did the whole of last week when trying to
work on my own. I'm sure that goes for all of us!

Charles
avatar
Mac
Re: The Portfolio
September 04, 2013 02:21PM
This forum is what this course is really about - consider your fees paid as access fees, so make use of it smiling smiley But always remember that the forum is not intended as a one-stop-solution shop (i.e. someone else just gives you the solution to your problem), but that it should be embraced it with the intention to learn and to teach! You all are to embrace teaching, I am just the facilitator!
Re: The Portfolio
September 04, 2013 04:54PM
Thanks everyone, it's a great relief to have some clarity.

CharlesU when we start on the specific pages I agree having a separate topic for each will be very helpful to organise the information and thought processes. At the moment all the questions still seem very general (especially mine, I'm all over the place right now).

I've noticed there is another similar topic on this forum basically about the same thing "Few questions about this project". I hope that one of the two will eventually take preference so we're all on the same page smile
Re: The Portfolio
September 04, 2013 06:10PM
Hi.


I am about to start my portfolio hence went through all concepts in Home & Learn, and Text book. This forum is a very important tool where we will be getting help and helping each other.
Re: The Portfolio
September 04, 2013 07:57PM
Hi. Regarding in data(info) of the students and Courses. Do we have to add our own students and courses ??? Or the database you will be opening it on will have all the info loaded on?
Re: The Portfolio
September 05, 2013 12:11PM
Quote
78185106
Hi. Regarding in data(info) of the students and Courses. Do we have to add our own students and courses ??? Or the database you will be opening it on will have all the info loaded on?

As far as I understand it I think they have an existing db that will load into your portfolio, and that is why it so important that we keep the structure of the database exactly the same as outlined in the Tut.
You will obviously have to load info into your own db to test your site works obviously, but that isn't for submission.

Mac please correct me if I'm wrong.
avatar Re: The Portfolio
September 05, 2013 12:34PM
Correct. You have to keep to the same database structure otherwise if it differs from the one that Mac uses, it is not going to work right. You will have to think up courses and student names to input into the database. This is the only way to test it to see that your data goes to the right fields in the database.



kiroant-77337840 Wrote:
-------------------------------------------------------
>
Quote
78185106
> Hi. Regarding in data(info) of the students and
> Courses. Do we have to add our own students and
> courses ??? Or the database you will be opening it
> on will have all the info loaded on?
>
>
> As far as I understand it I think they have an
> existing db that will load into your portfolio,
> and that is why it so important that we keep the
> structure of the database exactly the same as
> outlined in the Tut.
> You will obviously have to load info into your own
> db to test your site works obviously, but that
> isn't for submission.
>
> Mac please correct me if I'm wrong.
Re: The Portfolio
September 07, 2013 09:59AM
Hi all,

This teamwork thing is starting to work, even the naturals who are going to get distinctions are stepping in to help.
I asked what I thought was a trivial question about multiple submit buttons and landed up with a working page for
the Portfolio. Granted it needs tweaking, but it works!

Regards, CharlesU
Re: The Portfolio
September 08, 2013 12:22PM
Finished the tutorials and started with the portfolio this week.

Must admit I am experiencing many problems at this stage. Have started, deleted everything and started again twice now.

Am getting frustrated with errors etc. but after reading the forum I am feeling better. I will continue to try and figure out what I am doing wrong, but at least in I know where to turn to if I REALLY don't manage!

Good luck everyone!
Re: The Portfolio
September 08, 2013 03:16PM
Hello,

If this is not the correct place to post this question, please feel free to refer me.

I decided to start with the registration page of the portfolio, because I enjoy this part the most. I have however run into a Parse Syntax error that I cannot seem to find a solution to.
Below is my PHP code (I am only including part of it for this purpose. Please let me know if you need more. Note that I do not want to paste entire text, I am not sure if that is allowed for the portfolio project...)

Language: PHP
$sname = $_POST['sname'];     $SQL= "INSERT INTO student ( sname ) VALUES ( "$sname" ) ";

The error that I get is the following: Parse error: syntax error, unexpected '$sname' (T_VARIABLE)

Does anyone have a clue what this means and where I should start looking for the answer?

(I did go through all the suggestions in the textbook, referred back to the tutorials, watched many videos and gone through several forums on the internet with no success. So any suggestions are welcome.)
Re: The Portfolio
September 08, 2013 05:23PM
Hi Elizabeth,

I think the "$sname" variable should be between single quotes '$sname' . Try it out.
Some of us are waiting for someone to take the lead and start opening the individual Portfolio pages.
Would this one have been student_reg.php?

CharlesU
avatar Re: The Portfolio
September 08, 2013 05:45PM
You cannot put both the SQL statement and the variable inside double quotes.
Use double quotes on one, and single quotes on the other.
avatar Re: The Portfolio
September 09, 2013 09:16AM
Your query should be:

Language: PHP
$name = $_POST['sname'];   $SQL = "INSERT INTO student(sname) VALUES ('$name')";

You'll see I have changed the variable receiving the value to something else. From practise I have learned that if you have to many variables with the same name, and it comes to debugging time then, you have a horrible time trying to track down the one giving you the problem.
Re: The Portfolio
September 09, 2013 01:31PM
Good Morning Prof Mac.

Just quickly want to find out about the form with the student registration.

The option of choosing the course. I would like to use a drop down menu to choose the course the student wishes to study. In the a drop down menu there must be options available to choose from.Seeing that you will load up your database to our site we are building. how would it be possible for me to link the drop down menu to display the courses in your database? Or simple make it a text field where the student can enter the course name. There can go a lot of things wrong when relying on the student to type in the wright Course. Ideally I think it would be nice if the Student picks a course and with the selection of the course when the form is submitted the student will receive all the additional information about the course what was picked via e-mail.

Regards
Willem
avatar Re: The Portfolio
September 09, 2013 04:58PM
There is a way to use a drop down box, with all the courses in it. Give it a try and I can help you where you get stuck. smile


78185106 Wrote:
-------------------------------------------------------
> Good Morning Prof Mac.
>
> Just quickly want to find out about the form with
> the student registration.
>
> The option of choosing the course. I would like to
> use a drop down menu to choose the course the
> student wishes to study. In the a drop down menu
> there must be options available to choose
> from.Seeing that you will load up your database to
> our site we are building. how would it be possible
> for me to link the drop down menu to display the
> courses in your database? Or simple make it a text
> field where the student can enter the course name.
> There can go a lot of things wrong when relying on
> the student to type in the wright Course. Ideally
> I think it would be nice if the Student picks a
> course and with the selection of the course when
> the form is submitted the student will receive all
> the additional information about the course what
> was picked via e-mail.
>
> Regards
> Willem

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
avatar
Mac
Re: The Portfolio
September 09, 2013 05:10PM
78185106 Wrote:
-------------------------------------------------------
> Good Morning Prof Mac.
>
> Just quickly want to find out about the form with
> the student registration.
>
> The option of choosing the course. I would like to
> use a drop down menu to choose the course the
> student wishes to study. In the a drop down menu
> there must be options available to choose
> from.Seeing that you will load up your database to
> our site we are building. how would it be possible
> for me to link the drop down menu to display the
> courses in your database? Or simple make it a text
> field where the student can enter the course name.
> There can go a lot of things wrong when relying on
> the student to type in the wright Course. Ideally
> I think it would be nice if the Student picks a
> course and with the selection of the course when
> the form is submitted the student will receive all
> the additional information about the course what
> was picked via e-mail.
>
> Regards
> Willem

Exactly. Selection of a course/s should be presented in a drop-down to prevent typing errors - this is crucial to maintain database integrity.
Re: The Portfolio
September 11, 2013 09:49PM
At last I got that drop down menu to reflect the data in the database... spinning smiley sticking its tongue out
Re: The Portfolio
September 16, 2013 10:23PM
hi Collecting the data from the form for the student reg. I use the Following code:

I have got my Connect function and msql_query. but i still get errors sad smiley

Can anyone please help
Re: The Portfolio
September 16, 2013 10:26PM
Re: The Portfolio
September 16, 2013 10:30PM
just ignore the other two

Language: PHP
$sql= "INSERT INTO student(title,sname,fname,init,msname,dob,idno,gen,telh,telw,fax,cel,email,address,lang) VALUES('$_POST[title]','$_POST[sname]','$_POST[fname]','$_POST[init]','$_POST[msname]','$_POST[dob]','$_POST[idno]','$_POST[gen]','$_POST[telh]','$_POST[telw]','$_POST[fax]','$_POST[cel]','$_POST[email]','$_POST[address]','$_POST[lang]')";
avatar Re: The Portfolio
September 17, 2013 09:18AM
Your $_POST array field names need to be enclosed in quotes -

$_POST['sname']

You probably need to use the alternate notation to avoid multiple quotes -

'{$_POST[sname]}'

or, alternatively assign the $_POST array values to variables instead of using them directly.
avatar Re: The Portfolio
September 17, 2013 09:44AM
I would also rather assign the the values that you get from $_POST to variables and then use that in your SQL query. Something like this:

Language: PHP
$sql = "INSERT INTO student (sname,init,fname,title,msname,dob,gen,lang,idno,telh,telw,cel,fax,email,address,contact_flag) VALUES ('$studSn','$studIn','$studFn','$studTit','$studMn','$studDob','$studGen','$studLan','$studId', '$studTelh','$studTelw','$studCell','$studFax','$studEmail','$studAdr','$studShare')";






78185106 Wrote:
-------------------------------------------------------
> just ignore the other two
>
>
Language: PHP
> $sql= "INSERT INTO > student(title,sname,fname,init,msname,dob,idno,gen > ,telh,telw,fax,cel,email,address,lang) > VALUES('$_POST[title]','$_POST[sname]','$_POST[fna > me]','$_POST[init]','$_POST[msname]','$_POST[dob]' > ,'$_POST[idno]','$_POST[gen]','$_POST[telh]','$_PO > ST[telw]','$_POST[fax]','$_POST[cel]','$_POST[emai > l]','$_POST[address]','$_POST[lang]')"; >

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
Re: The Portfolio
September 17, 2013 11:47AM
Hi there,

Thanks AlexB and bigron11 for " keeping it simple". I was beginning to wonder which part of " The Tutorial" I missed!

CharlesU
Re: The Portfolio
September 17, 2013 01:03PM
Thanks Alex thumbs up
Re: The Portfolio
September 17, 2013 11:51PM
@78185106

Also remember to "clean up" your variables and not just to insert directly into the database what the user typed in the form fields - they may have typed some evil code!!
See "Chapter 9 - Security Issues" of the tutorial for more details!
Re: The Portfolio
September 18, 2013 01:14AM
Okay, question :
You have a function that takes arguments, however these arguments you pass will only be there sometimes if certain conditions are met (like an if statement /switch).
In order for the function to run without errors, must you create empty variables beforehand if the conditions aren't met, or is there some way to check in the function if these variables / arguments really exist.

To clarify what I mean here's an example :
If option1 is called then you call a function, get_my_var(), that will give $my_var a value. This value will then be used in function foobar().
However, when option2 is called you don't want to call the get_my_var() function because you won't actually be using the $my_var variable in foobar() then.

Should you just give $my_var an empty value like in the example below, or is there a better way to do it?

Language: PHP
switch ($action) { case "option1" : $my_var = get_my_var(); foobar($my_var); break;   case "option2" : $my_var = ""; foobar($my_var); break; }     Function foobar($my_var) { [...some code here...] }     Function get_my_var() { $my_var = "blahblahblah"; return $my_var; }
avatar Re: The Portfolio
September 18, 2013 08:02AM
You can use a default parameter -

An example -

Language: PHP
<?php function makecoffee($type = "cappuccino") { return "Making a cup of $type.\n"; } echo makecoffee(); echo makecoffee(null); echo makecoffee("espresso"); ?>
Re: The Portfolio
September 18, 2013 02:18PM
Ah, thanks a million bigron11!
I remember that example, can't seem to find it again on the tutorial - can you tell me which chapter that was?
avatar
Mac
Re: The Portfolio
September 18, 2013 02:26PM
If you set a default parameter, next time the function is called it "defaults" to this value. This may be useful, depending on how the function is used...
Re: The Portfolio
September 21, 2013 08:30PM
Hi all!

How is your Projects coming along?
Re: The Portfolio
September 22, 2013 09:22AM
Hi there,

Glad you asked! Running out of time, running out of ideas. The bright side, we've got each other and professional help!
Can you imagine doing this on your own???

All the best!
Re: The Portfolio
September 22, 2013 03:13PM
Thank you everyone for the advice!

I got it working, yay!

But now I have run into another problem. I was wondering if anyone else is experiencing the same problem.

When I refresh my student_reg.php, fill in the form for someone else and then click submit, the info for the previous form is sent a second time. To I end up having double entries for all forms completed.

Will continue looking for a solution, but if anyone else has the same problem please let me know!!!
avatar Re: The Portfolio
September 22, 2013 03:58PM
You shouldn't have to refresh the form to enter more data.

The behaviour you are describing is normal for a refresh.

An option is to get your form to load itself when you submit -

Language: HTML
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">


Then check the $_POST array for "Submit" and update database if that is true.


Alternatively, if you are using a separate script to process your form, you can use -
Language: PHP
header('Location:???');
to reload your page.
Re: The Portfolio
September 22, 2013 04:35PM
Thank you Bigron11!

I followed your suggestion and everything is working fine now!

Did not create a separate script for processing the form, as I am trying to keep to only the scripts we are supposed to have for the Portfolio assignment.
Sorry, only registered users may post in this forum.

Click here to login