Page 1 of 1

QUESTIONS

Posted: Mon Oct 12, 2009 11:47 pm
by Catalyst
Good day sirs,

I’m undergoing the programme ‘PHP and MySQL’ at your online facility. It should interest you to know that my USER ID is: FRANKLIN4EDUCATION.

I have the following questions and would appreciate an answer proffered to them:

1.
# Is this the symbol used in the examples:
<?php # dateform.php
$page_title = 'Calendar Form';
include ('./includes/header.html');

2. Pls explain these two symbols in the context of usage as show below (line 3 in x; and line 3 in y; in the case of y, I suppose it means that $day ‘is less than or equal to 31’):

3. Pls explain the symbol = as used in line ‘3’ in y. Kindly tell me its name since = = stands for ‘is equal to’.

(x)
// Make the months pull-down menu.
echo '<select name="month">';
foreach ($months as $key => $value) {
echo "<option value=\"$key\">$value</option>\n";
}
echo '</select>';

(y)
// Make the days pull-down menu.
echo '<select name="day">';
for ($day = 1; $day <= 31; $day++) {
echo "<option value=\"$day\">$day</option>\n";
}
echo '</select>';

Thank you.

Franklin.

Re: QUESTIONS

Posted: Tue Oct 13, 2009 12:08 am
by Weiry
For starters, when posting code, please wrap it using the code or php tags.
Catalyst wrote:1.
# Is this the symbol used in the examples:
Im not entirely sure what your question is...
# is commonly used for commenting a line of code, similar to using //

line 3 in x,
Catalyst wrote:foreach ($months as $key => $value) {
PHP Tutorial - For Each
'For each element of the $months associative array I want to refer to the key as $key and the value as $value."
Catalyst wrote:for ($day = 1; $day <= 31; $day++) {
This loop sets the variable $day to 1; While $day is less than or equal to 31; increment $day after the loop is completed.