Welcome! Log In Create A New Profile

Advanced

Topic 4A

Posted by joomlahost 
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
Topic 4A
July 11, 2008 05:37PM
Arrays, GET, POST -> foreach makes more sense...
Completed
Anonymous User
Re: Topic 4A
July 28, 2008 04:15PM
I agree with Joomlahost foreach is straight forward.
Done with Topic 4A.

Mamog
smoking smiley Re: Topic 4A
August 07, 2008 07:36AM
smoking smiley

Done with Topic 4A

Ryan Harris
Anonymous User
Re: Topic 4A
August 12, 2008 04:03PM
Again lost after problems in "Applying your knowledge 3-1" and "Task 3B-2".
I get a warning in thankyou.php - Task 4A-1 - and also my firstname and lastname is not shown:
Warning: Invalid argument supplied for foreach() in C:\xampp\xampp\htdocs\exercises\thankyou.php on line 9
This is the code in thankyou.php:
<?php

$title = "Thank-you";
include("header.php"winking smiley;
echo "Thanks for responding to this survey $firstname $lastname";
echo "<br><br>";
echo "<b>These are your favorite book categories:</b>";
echo "<br><br>";
foreach ($choice as $category) {
echo "$category< <br>\n";
echo "$category< <br>\n";
}
include("footer.php"winking smiley;
?>

Does anybody has a hint for me. I also have problems in using the $_POST super global array. I would be glad to get some more information after reading the relevant parts in the textbook and the php manual.
THANKS!!!
Iris
avatar
Mac
Re: Topic 4A
August 14, 2008 07:06AM
Why do you have two echo "$category< <br>\n";
Anonymous User
Re: Topic 4A
August 14, 2008 09:57AM
Oh sorry, that was just an error in copy&paste.

Can I use your hint for "applying knowledge 3-1" for placing the $_POST?

Or is it the $_GET which I found in the sem1 forum?

Greetings
Iris
avatar
Mac
Re: Topic 4A
August 14, 2008 12:22PM
If the form method with which you get the firstname and lastname is post
e.g. <form method=post action="thankyou.php">
then on the receiving page (thankyou.php) you use $firstname=$_POST['firstname'];

If the form method with which you get the firstname and lastname is GET
e.g. <form method=getaction="thankyou.php">
then on the receiving page (thankyou.php) you use $firstname=$_GET['firstname'];

PHP4 use to do this automatically for you - not anymore. You now have to do this
Anonymous User
Re: Topic 4A
August 14, 2008 05:34PM
Yeah, now I have got it. Here is my script for thankyou.php:
<?php

$title = "Thank-you";
include("header.php"winking smiley;
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];

echo "Thanks for responding to this survey $firstname $lastname";
echo "<br><br>";
echo "<b>These are your favorite book categories:</b>";
echo "<br><br>";
$choice = $_POST['choice'];
foreach ($choice as $category) {
echo "$category <br>\n";
}
include("footer.php"winking smiley;
?>

I found a very good tutorial in the Internet under http://www.tizag.com/phpT/forms.php

Regards,
Iris
Anonymous User
Re: Topic 4A
August 18, 2008 09:47AM
Topic completed, no major issues - DH
Re: Topic 4A
August 18, 2008 09:53AM
Completed topic 4A with no real problems

Gareth
Re: Topic 4A
August 28, 2008 09:11AM
Done

Completed Successfully with no problems what so ever! smiling smiley
Re: Topic 4A
September 02, 2008 05:28PM
Hi,

Topic 4A has been completed.

Kind Regards

Justin Leaf-Wright

www.leafydesignz.co.za

hot smiley
Re: Topic 4A
October 01, 2008 09:23PM
4A completed!
Sorry, only registered users may post in this forum.

Click here to login