Welcome! Log In Create A New Profile

Advanced

Lesson 2A & 2B

Posted by Lize 
Announcements Last Post
Announcement myUnisa availability 21 to 24 March 2019 03/25/2019 12:25PM
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
Lesson 2A & 2B
February 02, 2010 03:31PM
Just a question.

I will probally finish these two before 1A and 1B. As I am working through the Masterskills manual page by page as not to lose any info.

Will that be okay
avatar
Mac
Re: Lesson 2A & 2B
February 03, 2010 07:00AM
You can work backwords through the manual if you want, although that would probably make it a bit harder smiling smiley
Re: Lesson 2A & 2B
February 03, 2010 08:17AM
Okay thanxs
Anonymous User
Re: Lesson 2A & 2B
February 16, 2010 10:55AM
Hi

I am still not 100% with the coding's
but I have completed task 2A thanks for your help
do I only use POST to combine HTML and PHP if I work with the to coding's together
Anonymous User
Re: Lesson 2A & 2B
February 16, 2010 12:21PM
Hi

why in task 2A-1 Variables
when you put the ISSET CODE you add ECHO in front of it
<echo isset($computer);>

but when you UNSET there is no ECHO in front of UNSET
<unset ($computer);>
why is it like that
avatar
Mac
Re: Lesson 2A & 2B
February 16, 2010 12:39PM
the "echo" is a built-in function (it works by itself to do stuff) that prints stuff
isset is a function that checks if a variable exists
so
Language: PHP
echo isset($computer);

means print the variable $computer (if it exists)

unset is a function that merely destroys the variable. You can't print something that you have just destroyed, so there is nothing to print!

You could do this though:
Language: PHP
unset ($computer); echo "The variable has been destroyed!";
Anonymous User
Re: Lesson 2A & 2B
February 16, 2010 01:45PM
ok thanks I understand
Anonymous User
Re: Lesson 2A & 2B
February 18, 2010 12:04PM
Hi

when I submit my book from the selection list it doesn't display
the selected books name ore the author
it only displays "The author of is."

I don't think it is correct am I doing something wrong
can you pleas assist me

<?php
$books["Romeo and Juliet"] = "William Shakespeare";
$books["Exobiology: An Introduction"] = "Jonathan Drake";
$books["War and Peace"] = "Leo Tolstoy";
$books["Portrait of the Artist"] = "James Joyce";
$books["The Lion, The Witch, and the Wardrobe"] = "CS Lewis";
$author = $books[$SelectedBook];
echo "The author of $SelectedBook is $author.";
?>

Thanks
avatar
Mac
Re: Lesson 2A & 2B
February 18, 2010 03:57PM
Come on other students - you're supposed to help as well!

All I'm going to say now (I want you to struggle) is that you must look at the previous forums. Post here only if you can't find the answer there (this is an important skill and I am not going to feed you smiling smiley ). It is no use we just correct your code for you smiling smiley

Plus - have you got the handbook and have you read the relevant pages that is related to this topic? If you work just out of the manual you will not get it to work..!

Ok, I'll be nice this time - see here http://osprey.unisa.ac.za/phorum/read.php?265,85854
Exactly your problem...! And the solution.

I'll give you another clue - see the last post http://osprey.unisa.ac.za/phorum/read.php?215,73661 and try and read up on $_POST and $_GET and what it does to resolve your problem.
avatar Re: Lesson 2A & 2B
February 19, 2010 08:36AM
try this I'm not so sure either
Language: PHP
<?php $tireqty = $_POST[‘tireqty’]; $oilqty = $_POST[‘oilqty’]; $sparkqty = $_POST[‘sparkqty’]; ?>

gbakamela [77234715]
avatar Re: Lesson 2A & 2B
February 19, 2010 09:23AM
There are two ways around this problem:
Use double quotes if the text includes any apostrophes.
Precede apostrophes with a backslash (this is known as escaping).
So, either of the following is acceptable:
Language: PHP
$book['description'] = "This is David's sixth book on PHP."; $book['description'] = 'This is David\'s sixth book on PHP.';

Language: PHP
$play = "Shakespeare's "Macbeth"";
In this case the apostrophe is fine, because it doesn’t conflict with the double quotes, but
the opening quotes in front of Macbeth bring the string to a premature end. To solve the
problem, either of the following is acceptable:

I hope this will solve the problem unless I'm missing your core problem (NERDO!)

gbakamela [77234715]
Anonymous User
Re: Lesson 2A & 2B
February 22, 2010 12:06PM
Hi

I have completed 2B-1

$SelectedBook=$_POST['SelectedBook'];
the code doesn't work in small caps
ones I changed it to capital letters it worked

thanks for all the help
Re: Lesson 2A & 2B
February 22, 2010 03:22PM
Cool I wonder why I had it working...
Sorry, only registered users may post in this forum.

Click here to login