Untitled
Untitled
Untitled
Duha Qutishat
____________________________________________________________________________________
Note :Most examples are quoted from Internet & World Wide Web How to Program, 5th edition by H.
Deitel, P. Deitel. 2012 and http://www.w3schools.com.
Level 1 Heading
Level 2 heading
Level 3 heading
Level 4 heading
Level 5 heading
Level 6 heading
HU
Facebook
Twitter
Google
HU
Facebook
Twitter
Google
Link to heading 1
Link to heading 2
Heading 1
Text text text text
Heading 2
Text text text text
Link to heading 1
Link to heading 2
Heading 1
Text text text text
Heading 2
Text text text text
back to page1
Q1) insert the following Water lilies.jpg image into an HTML file .
Note: width = "122"
height = "120"
alt=”This is a water lilies image”
IT majors : IT majors :
1. CS CS
2. CIS CIS
3. SWE SWE
Q2)Nested lists
My Favourites
Programming
websites
languages
1.Google JAVA
C++
2.Yahoo
HTML
3.Youtube
Registration form
First Name
Last Name
Password
Country
<h1>
with class
called
special
<p>
<h1>
<em>
>
<p>
with class
called
special
<h1>
> <em>
<em> Hyperlink to
“http://www.deitel.com”
Q1)Text alignment:
Q2)Text indentation
text-indent:50px
Q3)Text decoration
Q1)List-style-type
Q3) list-style-position
Q2)Overflow
Write the following text 4 time in yout HTML file and create 4 classes name them
class1,class2,class3 and class4.
You can use the overflow property when you want to have better control of
the layout. The default value is visible.
Q2) Padding: Write the following two paragraphs in your html file
Q1)Display
Create the following html file and change the value of display property
to : -inline
-block
-none
Arial
DarkBlue lightGrey
18pt Attachment fixed
Q1)border
Apply pos_fixed
class to this
sentence
Apply pos_left
class to this
sentence
Apply pos_right
class to this
sentence
Apply pos_absolute
class to this
sentence
b- print out the data type of each variable (hint: use gettype() function)
e.g gettype($num1);
- type casting
e.g: (data type) $variable_name
Q4: write a program that calculate the area and circumference of a circle with
a radius =4
Circle area=(radius)2 * 𝝅
Circle circumference= 2*radius* 𝝅
𝝅 (pi) =3.14
a-Write a PHP code to create the following array and name it(first).
$first[0]=”PHP”;
$first[1]=”JAVA”;
$first[2]=”CSS”;
$first[3]=”HTML”;
b- Print each element’s index and value for array (first) using for loop and count function:
for($i=0;$i<count($first);$i++)
print(“Element $i is $first[$i]<br>”);
d- Print each element’s index and value for array (first) using for loop and count function:
for($i=0;$i<count($second);$i++)
print(“Element $i is $second[$i]<br>”);
$mark[“ahmad”]=90;
$mark[“muna”]=55;
$mark[“kareem”]=45;
$mark[“salma”]=100;
b-Print each element’s index and value for array(mark) using reset, key and next functions:
for(reset($mark);$element=key($mark);next($mark))
print(“<p>$element is $mark[$element]</p>”);
foreach($months as $element=>$value)
print(“<p> $element is the $value month in the year </p>”);
Q3:Write a PHP code to create an associative array called (ages) and fill it with the age of
each person as the following :
Basshar 23, sara 13 , saleem 65 and suha 57 years old
your program must print out the name of the eldest and the name of the youngest person.
elseif(strcmp($array[$i],"hi")>0)
print("<p>".$array[$i]."is greater than hi"."</p>");
else
print("<p>".$array[$i]."is equal to hi"."</p>");}
Hi duha. Thank you for completing the survey. You have been added to the
Java How to Program mailing list.
The following information has been saved in our database:
Name: duhaQutishat
Email: duha@hu.edu.jo
Phone: (555) 555-5555
OS: Linux
This is only a sample form. You have not been added to a mailing list.
PART2(HTML File):
Create HTML form as shown in the following picture(the value of each
option in the select list is the same name of database table fields.
Ex:<option value=”std_id”>ID</option>
c)Using query
$query = "SELECT * FROM std_info "
$result = mysql_query( $query, $database )
e)Print result:
1)fetch each record in result set
<table>
while ( $row = mysql_fetch_row( $result ) )
{ print( "<tr>" ); // build table to display results
foreach ( $row as $value )
print( "<td>$value</td>" );
print( "</tr>" );
</table>}
Note:
you can use any time die function to terminate the process in 2
ways:
- die( "some message </body></html>" )
- die( mysql_error() . "</body></html>" ) Ms. Duha Qutishat
Chapter #3
Forms part2:
- New HTML 5 input types:
Attribute Example
name
1) <header> …….</header>
2) <footer>…….</footer>
3) <section id=”1”> ………..</section>
4) <nav>……….</nav>
5) <figure>………</figure>
6) <figcaption>……</figcaption>
7) <article>….</article>
8) <details><summary>…….</summary>……</details>
9) <aside>….</aside>
10) <time>……</time>
11) <mark>….</mark>
12) <address>……..</address>
Expression Description
[acb]
[231]
Metacharacters:
Quantifiers:
p+ It matches any string containing at least one p. {1,} one or more times
p* It matches any string containing zero or more {0,} zero or more times
p's.
Expression Description
[[:lower:]]
[[:upper:]]
Metacharacters(2)
A metacharacter is simply an alphabetical character preceded by a backslash that acts to give the combination a special meaning.
For instance, you can search for large money sums using the '\d' metacharacter:/([\d]+)000/, Here \d will search for any string
of numerical character.
Following is the list of metacharacters which can be used in PERL Style Regular Expressions.
Character Description
. a single character
\s a whitespace character (space, tab, newline)
\S non-whitespace character
\d a digit (0-9)
\D a non-digit
\w a word character (a-z, A-Z, 0-9, _)
\W a non-word character
[aeiou] matches a single character in the given set
[^aeiou] matches a single character outside the given set
(foo|bar|baz) matches any of the alternatives specified
Modifiers
Several modifiers are available that can make your work with regexps much easier, like case sensitivity, searching in multiple lines
etc.
Modifier Description
i Makes the match case insensitive