You are on page 1of 41

EXERCITII IN PHP:

Exemplul 1:
<?php
echo "ACEASTA ESTE PRIMUL EXERCITIU IN PHP.";
?>
Exemplul 2:
<?php
echo "<img src='poze/perl.gif'alt='camila'><font
size='6'color='red'>Salut</FONT> vizitatorule!";
echo "<br><a href='http://www.google.ro'> go </a><br>";
?>
Exemplul 3:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
echo $a." are ".$b." ani. ";
echo "<br><font color='green'size='5'>".$a."</font><b> are </b><font
color='blue'>".$b."</font><i><font size='1'> ani </font></i>."
?>

Exemplul4:
<?php
$a=$_POST["t3"];
$b=$_POST["t4"];
echo $a." are ".$b." ani. ";
if ($b<20)
echo $a." este prea mic.";
else
if ($b==20)
echo $a." esti potrivit <br> <a href='http://www.google.ro'>google</a>";
else
echo $a." este prea mare <br> <a href='http://www.yahoo.com'>yahoo</a>";
?>
Exemplul 5:
<?php
$a=$_POST["t5"];
$b=$_POST["t6"];
if($a=="vizitator"&&$b=="123")
echo "<a href='http://www.google.ro'>go</a>";
else
echo "<html>
<head>
<title></title>
</head>
<body bgcolor='#ccc0000'><h1>EROARE</h1>
<form name='f3' action='ex5.php' method='POST'>
<h1>NUME:</h1> <input type='text' name='t5'><BR><BR>
<h1>PAROLA:</h1> <input type='password' name='t6'> <br><br>
<BR><input type='submit'VALUE='TRIMITE'>

<br><input type='reset' value='reset'>


</form>
</body>
</html>";
?>
Exemplul 6: <?php
$a=$_POST["t5"];
$b=$_POST["t6"];
if($a=="vizitator"&&$b=="123")
echo "<a href='http://www.google.ro'>go</a>";
else
if ($a!="vizitator"&&$b=="123")
echo"<html>
<head>
<title></title>
</head>
<body bAckground='poze/BACKGRND.GIF'><h1>EROARE LA NUME</h1>
<form name='f3' action='ex6.php' method='POST'>
<h1>NUME:</h1> <input type='text' name='t5'><BR><BR>
<h1>PAROLA:</h1> <input type='password' name='t6'> <br><br>
<BR><input type='submit'VALUE='TRIMITE'>
<br><input type='reset' value='reset'>
</form>
</body>
</html>";
else
if ($a=="vizitator"&&$b!="123")
echo"<html>
<head>
<title></title>
</head>
<body background='poze/BACKGRND.GIF'><h1>EROARE LA PAROLA</h1>
<form name='f3' action='ex6.php' method='POST'>
<h1>NUME:</h1> <input type='text' name='t5'><BR><BR>
<h1>PAROLA:</h1> <input type='password' name='t6'> <br><br>
<BR><input type='submit'VALUE='TRIMITE'>
<br><input type='reset' value='reset'>
</form>
</body>
</html>";
else
echo "<html>
<head>
<title></title>
</head>
<body background='poze/BACKGRND.GIF'><h1>AMBELE GRESITE</h1>
<form name='f3' action='ex6.php' method='POST'>
<h1>NUME:</h1> <input type='text' name='t5'><BR><BR>
<h1>PAROLA:</h1> <input type='password' name='t6'> <br><br>
<BR><input type='submit'VALUE='TRIMITE'>
<br><input type='reset' value='reset'>
</form>
</body>
</html>";
?>

Exemplul7:
<?php
$a=$_POST["t5"];
$b=$_POST["t6"];
if($a=="vizitator"&&$b=="123")
echo "<a href='http://www.google.ro'>go</a>";
else
if ($a!="vizitator"&&$b=="123")
echo"<html>
<head>
<title></title>
</head>
<body background='poze/BACKGRND.GIF'><h1>EROARE LA NUME</h1>
<form name='f3' action='ex7.php' method='POST'>
<h1>NUME:</h1> <input type='text' name='t5'value='".$a."'><BR><BR>
<h1>PAROLA:</h1> <input type='password' name='t6'value='".$b."'> <br><br>
<BR><input type='submit'VALUE='TRIMITE'>
<br><input type='reset' value='reset'>
</form>
</body>
</html>";
else
if ($a=="vizitator"&&$b!="123")
echo"<html>
<head>
<title></title>
</head>
<body background='poze/BACKGRND.GIF'><h1>EROARE LA PAROLA</h1>
<form name='f3' action='ex7.php' method='POST'>
<h1>NUME:</h1> <input type='text' name='t5'value='".$a."'><BR><BR>
<h1>PAROLA:</h1> <input type='password' name='t6'value='".$b."'> <br><br>
<BR><input type='submit'VALUE='TRIMITE'>
<br><input type='reset' value='reset'>
</form>
</body>
</html>";
else
echo "<html>
<head>
<title></title>
</head>
<body background='poze/BACKGRND.GIF'><h1>AMBELE GRESITE</h1>
<form name='f3' action='ex7.php' method='POST'>
<h1>NUME:</h1> <input type='text' name='t5'value='".$a."'><BR><BR>
<h1>PAROLA:</h1> <input type='password' name='t6'value='".$b."'> <br><br>
<BR><input type='submit'VALUE='TRIMITE'>
<br><input type='reset' value='reset'>
</form>
</body>
</html>";
?>

Exemplul8:
<?php
$a =$_POST["c1"];
$b =$_POST["c2"];
if ($a && $b)
echo "ati ales".$a."si".$b;
else
if ($a &&!$b)
echo "ati ales".$a;
else
if (!$a && $b)
echo "ati ales".$b;
else
echo "nu ati ales";
?>
Exemplul9:
<?php
$a =$_POST["c1"];
$b =$_POST["c2"];
$c =$_POST["c3"];
$d =$_POST["c4"];
$mesaj="";
if($a)$mesaj=$mesaj.$a."
if($b)$mesaj=$mesaj.$b."
if($c)$mesaj=$mesaj.$c."
if($d)$mesaj=$mesaj.$d."
if($mesaj=="")$mesaj="nu
echo $mesaj;
?>

";
";
";
";
ati ales nimic.";

Exemplul 10:
<?php
$x1a=$_POST["c1a"];
$x1b=$_POST["c1b"];
$x1c=$_POST["c1c"];
$x2a=$_POST["c1a"];
$x2b=$_POST["c2b"];
$x2c=$_POST["c2c"];
$x3a=$_POST["c3a"];
$x3b=$_POST["c3b"];
$x3c=$_POST["c3c"];
$x=$_POST["t1"];
$nota=1;
if(!$x1a&&$x1b&&!$x1c)
$nota=$nota+3;
if(!$x2a&&$x2b&&$x2c)
$nota=$nota+3;
if(!$x3a&&!$x3b&&!$x3c)
$nota=$nota+3;
echo"D-l".$x."a obtinut nota .".$nota;
?>
Exemplul 11:
<?php
$a=$_POST["r"];
if ($a)

echo"Ati ales ".


?>
Exemplul 12:
<?php
$a=$_POST["r"];
if($a)
echo"<html>
<head>
<title></title>
<style>
input{font-size:24;color:blue;}
</style>
</head>
<body bgcolor='".$a."'>
<table bgcolor='ffcc000' border='4' bordercolor='blue' width='30%'
align='center'>
<tr>
<td>
<h2><form name='f6' action='ex12.php' method='POST'>
buton 1<input type='radio' name='r' value='#ffcc000'><br>
buton 2<input type='radio' name='r' value='green'><br>
buton 3<input type='radio' name='r' value='red'><br><br>
<input type='submit' name='s' value='submit'></h2><br>
<input type='reset' name='r' value='reset'><BR>
</td>
</tr>
</form>
</table>
</body>
</html>";
?>
Exemplul13:
<?php
$a=$_POST["r"];
$b=$_POST["p"];
if($a&&$b)
echo"<html>
<head>
<title></title>
</head>
<body bgcolor='".$a."' text='".$b."'>
<table bgcolor='ffcc000' border='4' bordercolor='blue' width='30%'
align='center'>
<tr>
<td>
<h2><form name='f7' action='ex13.php' method='POST'>
buton 1<input type='radio' name='r' value='#ffcc000'><br>
buton 2<input type='radio' name='r' value='green'><br>
buton 3<input type='radio' name='r' value='red'><br><br>
buton 4<input type='radio' name='p' value='#ffccccc'><br>
buton 5<input type='radio' name='p' value='pink'><br>
buton 6<input type='radio' name='p' value='yellow'><br><br>

<input type='submit' name='s' value='submit'></h2><br>


<input type='reset' name='r' value='reset'><br>
</td>
</tr>
</form>
</body>
</html>";

?>
Exemplul14:
<?php
$a=$_POST["s"];
if($a)
echo"Ai ales ".$a;
else
echo"Nu ai ales nimic."
?>
Exemplul15:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
$c=$_POST["s"];
$d=$_POST["r"];
$e=$_POST["c1"];
$f=$_POST["c2"];
if(!$c)
$c="nu ai ales curs.";
if(!$d)
$d="nu ai ale orar.";
$x="";
if($e)
$x=$x.$e." ";
if($f)
$x=$x.$f." ";
if($x=="")
$x="nu ai ales nivelul";
echo"d-l/d-na".$a." ".$b."a ales cursul".$c."a ales orarul".$d."la
nivelul".$x;
?>
Exemplul16:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
$c=$_POST["t3"];
$d=$_POST["t4"];
$x=strlen($a);
echo"sirul are".$x." caractere <br>";
if (strcmp($b,$c)>0)
echo"sirul ".$b." este mai mare<br>";
else
if(strcmp($b,$c)<0)
echo" sirul ".$c." este mai mare <br>";

else"sirurile sunt egale.";


$p=strtolower($a);
$r=strtoupper($b);
$s=ucfirst($c);
$t=ucwords($d);
echo$p."<br>";
echo$r."<br>";
echo$s."<br>";
echo$t."<br>";
if(strstr($a,$b))
echo strstr($a,$b);
else
echo"nu exista";
?>
Exemplul17:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
if((strtolower($a)=="abc")&&($b=="xyz"))
echo"ok";
else
echo"eroare";
?>
Exemplul 18:
<?php
$a=$_POST["t1"];
$b=strstr($a,"@");
if($b)//$b=@yahoo.com
{
$c=strstr($b,".");
if($c)//$c=.com
{
$d=strlen($c);
if($d>=3)
echo"ok";
else
echo" prea putine caractere dupa punct.";
}
else
echo"lipseste punctul";
}
else
echo"lipseste @";
?>
Exemplul 19:
<?php
$a=array("ian","febr","martie","aprilie","mai","iunie");
echo"A treia luna este"." ".$a[2].".<br>";
echo"Primele 6 luni sunt: ";
for ($i=0;$i<6;$i++)

echo$a[$i]." ";
echo".<br><br><br>";
sort($a);
echo"TABLOUL ORDONAT:<br> ";
for ($i=0;$i<6;$i++)
echo$a[$i]."<br> ";
echo"<br><br><br>";
$b=array(array("ian","febr","martie"),array("aprilie","mai","iunie"));
echo $b[0][1];
echo"<br><br><br>";
for($i=0;$i<2;$i++)
{
for ($j=0;$j<3;$j++)
echo $b[$i][$j]." ";
echo"<br>";
}
echo"<br><br><br>";
$x=array("prima"=>"ianuarie","a 2-a"=>"februarie","a 3-a"=>"martie");
echo$x["a 3-a"];
echo"<br><br><br>";
print_r($x);
echo"<br><br><br>";
$stiinte=array(
"exacte"=>array(
"unu"=>"mate",
"doi"=>"fizica",
"trei"=>"chimie"),
"sociale"=>array(
"unu"=>"filosofie",
"doi"=>"sociologie",
"trei"=>"psihologie")
);
echo$stiinte["exacte"]["trei"];
echo"<br><br><br>";
print_r($stiinte["sociale"]);
echo"<br><br><br>";
$y=implode($x,", ");
echo$y;
echo"<br><br><br>";
$sir="mere,pere,pepeni";
$z=explode(",",$sir);
echo$z[2];
?>
Exemplul 20:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
mysql_connect("localhost","","")or die("eroare la conexiune");
mysql_select_db("agenda1")or die ("eroare la baza de date");
$x="select * from utilizatori where nume='".$a."'and parola='".$b."';";
$y=mysql_query($x);
$k=0;
while($z=mysql_fetch_array($y))
if($z["nume"]==$a
&&$z["parola"]==$b)
$k=1;

if($k==0)
echo"eroare la nume sau la parola";
else echo"ok";
?>
Exemplul 21(inregistrarea userului):

<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
mysql_connect("localhost","","")or die("eroare la conexiune");
mysql_select_db("agenda1")or die ("eroare la baza de date");
$x="select * from utilizatori where nume='".$a."'and parola='".$b."';";
$y=mysql_query($x);
$k=0;
while($z=mysql_fetch_array($y))
if($z["nume"]==$a
&&$z["parola"]==$b)
$k=1;
if($k==0)
{echo"
<html>
<head>
<title>
</title>
</head>
<body bgcolor='#ffcccc'text='blue'>
<form name='f2'action='fis1.php' method='POST'>
<h1>Vreti sa va inregistrati?</h1>
<h2>da:<input type='radio'value='da'name='r'></h2><br>
<h2>nu:<input type='radio'value='nu'name='r'></h2><br>
<input type='submit'value='submit'><br><br>
<input type='reset'value='reset'><br><br>
</form>
</body>
</html>";}
else
echo"ok";
?>
Exemplul 22-stergere inregistrare:
<?php
$a=$_POST["t1"];
echo$a." ".$b." ";
mysql_connect("localhost","","")or die("eroare la conexiune");
mysql_select_db("agenda1")or die("eroare la conexiune");
$x="delete from prieteni where id='".$a."';";
$y=mysql_query($x);
if($y)echo"ok";
else echo "eroare la conexiune";
?>

Exemplul23:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
echo$a." ".$b." ";
mysql_connect("localhost","","")or die("eroare la conexiune");
mysql_select_db("agenda1")or die("eroare la conexiune");
$x="update prieteni set telefon='".$b."'where id='".$a."';";
$y=mysql_query($x);
if($y)echo"ok";
else echo "eroare la conexiune";
?>
Exemplul 24- introducere php:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
$c=$_POST["t3"];
$d=$_POST["t4"];
$e=$_POST["t5"];
echo$a." ".$b." ".$c." ".$d;
mysql_connect("localhost","","")or die("eroare la conexiune");
mysql_select_db("agenda1") or die("eroare la conexiune");
$x="insert into prieteni set
nume='".$a."',prenume='".$b."',varsta='".$c."',telefon='".$d."',adresa='".$e.
"';";
$y=mysql_query($x);
if($y)echo"ok";
else echo"eroare la introducere";
?>
Exempul25-fisier2:
<?php
$a=$_POST["t1"];
$b=$_POST["t2"];
mysql_connect("localhost","","")or die("eroare la conexiune");
mysql_select_db("agenda1")or die ("eroare la baza de date");
$x="insert into utilizatori set nume='".$a."',parola='".$b."';";
$y=mysql_query($x);
if($y)
echo"ati introdus cu succes!";
else
echo"eroare la introducere"
?>
Exemplul26-fisier 1:
<?php
$a=$_POST["r"];
if($a=="da")
echo"<html>
<head>
<title>
</title>

10

</head>
<body bgcolor='#fffcc00'>
<form name='f'action='fis2.php'method='POST'>
INTRODUCETI DATELE DE IDENTIFICARE :<BR>
NUME <input type='text'name='t1'><br><br>
PAROLA<input type='text'name='t2'><br><br>
<input type='submit'value='submit'>
<br><input type='reset'value='reset'><br>
</form>
</body>
</html>";
else include("24 ian ex20 inregistrarea userului.html")
?>

11

HTML
Exercitii in html:
Ex3:
<html>
<head>
<title></title>
</head>
<body bgcolor="#ccccfff">
<form name="f1" action="ex3.php" method="POST">
<h1>NUME:</h1> <input type="text" name="t1"><BR><BR>
<h1>VARSTA:</h1> <input type="text" name="t2"> <br><br>
<BR><input type="submit"VALUE="TRIMITE">
</form>
</body>
</html>

Ex4:
<html>
<head>
<title></title>

12

</head>
<body bgcolor="#fffffff">
<form name="f2" action="ex4.php" method="POST">
<h1>NUME:</h1> <input type="text" name="t3"><BR><BR>
<h1>VARSTA:</h1> <input type="text" name="t4"> <br><br>
<BR><input type="submit"VALUE="TRIMITE">
</body>
</html>

Ex5:
<html>
<head>
<title></title>
</head>
<body bgcolor="#ccc0000">
<form name="f3" action="ex5.php" method="POST">
<h1>NUME:</h1> <input type="text" name="t5"><BR><BR>
<h1>PAROLA:</h1> <input type="password" name="t6"> <br><br>
<BR><input type="submit"VALUE="TRIMITE">
<br><input type="reset" value="reset">
</form>
</body>
</html>

13

Ex6:
<html>
<head>
<title></title>
</head>
<body background="poze/BACKGRND.GIF">
<form name="f3" action="ex6.php" method="POST">
<h1>NUME:</h1> <input type="text" name="t5"><BR><BR>
<h1>PAROLA:</h1> <input type="password" name="t6"> <br><br>
<BR><input type="submit"VALUE="TRIMITE">
<br><input type="reset" value="reset">
</form>
</body>
</html>

14

Ex7:
<html>
<head>
<title></title>
</head>
<body background="poze/BACKGRND.GIF">
<form name="f3" action="ex7.php" method="POST">
<h1>NUME:</h1> <input type="text" name="t5"><BR><BR>
<h1>PAROLA:</h1> <input type="password" name="t6"> <br><br>
<BR><input type="submit"VALUE="TRIMITE">
<br><input type="reset" value="reset">
</form>
</body>
</html>

15

Ex.8:
<html>
<head>
<title></title>
</head>
<body bgcolor="ffcc000">
<form name="f4" action="11 ian ex8.php" method="POST">
<H2>FORMULAR:</H2>
<H2>caseta 1:<input type="checkbox" name="c1" value="blue"></H2>
<H2>caseta 2:<input type="checkbox" name="c2" value="green"></H2>
<input type="reset" name="r" value="reset"><br>
<input type="submit" name="s" value="submit"><br>
</form>
</body>
</html>

16

EX9:
<html>
<head>
<title></title>
</head>
<body bgcolor="ffcc000">
<form name="f4" action="ex9.php" method="POST">
<H2>FORMULAR:</H2><BR><BR>
<H2>caseta 1:<input type="checkbox" name="c1"
value="blue"></H2><br><br><br><br>
<H2>caseta 2:<input type="checkbox" name="c2"
value="green"></H2><br><br><br><br>
<H2>caseta 3:<input type="checkbox" name="c3"
value="red"></H2><br><br><br><br>
<H2>caseta 4:<input type="checkbox" name="c4"
value="yellow"></H2><br><br><br><br>
<input type="reset" name="r" value="reset"><br><br><br>
<input type="submit" name="s" value="submit">
<br><Br><br>
</form>
</body>
</html>

17

EX10:
<html>
<head>
<title>
</title>
<style>
input {font-size:24;color:blue;}
</style>
</head>
<body background="poze/lvback.gif">
<H2><font color="red"style="comic sans ms">FORMULAR</font></H2>
<form name="f5" action="ex10.php" method="POST">
<h3>nume:<input type="text" name="t1">
<br>
</h3>
<h3>1.Cum e vremea afara?<br>
a)ploioasa<input type="checkbox" value="z" name="c1a" ><br>
b)geroasa<input type="checkbox" value="z" name="c1b" ><br>
c)calduroasa<input type="checkbox" value="z" name="c1c"><br>
2.Cate zile pe saptamana avem cursuri?<br><br>
a)luni<input type="checkbox" value="z" name="c2a" ><br>
b)sambata<input type="checkbox" value="z" name="c2b" ><br>

18

c)duminica<input type="checkbox" value="z" name="c2c"><br>


3.Am dat vreun examen din modulele studiate?<br><br>
a)da,la modulul html<input type="checkbox" value="z" name="c3a" ><br>
b)da,la modulul de php<input type="checkbox" value="z" name="c3b" ><br>
c)da,la modulul de java script<input type="checkbox" value="z"
name="c3c"></h3><br>
<input type="submit" value="submit" name="buton1"><BR>
<input type="reset" value="reset" name="buton2"><br>
</form>
</body>
</html>

Ex11:
<html>
<head>
<title></title>
<style>
input{font-size:24;color:blue;}
</style>
</head>
<body bgcolor="black">
<table bgcolor="ffcc000" border="4" bordercolor="blue" width="30%"
align="center">
<tr>

19

<td>
<form name="f6" action="ex11.php" method="POST">
buton 1<input type="radio" name="r" value="blue"><br>
buton 2<input type="radio" name="r" value="green"><br>
buton 3<input type="radio" name="r" value="red"><br><br>
<input type="submit" name="s" value="submit"><br>
<input type="reset" name="r" value="reset"><BR> </form>
</td>
</tr>
</table>
</body>
</html>

Ex12:
<html>
<head>
<title></title>
<style>
input{font-size:24;color:blue;}
</style>
</head>
<body bgcolor="blue">
<table bgcolor="ffcc000" border="4" bordercolor="blue" width="30%"
align="center">
<tr>

20

<td>
<form name="f6" action="ex12.php" method="POST">
buton 1<input type="radio" name="r" value="#ffcc000"><br>
buton 2<input type="radio" name="r" value="green"><br>
buton 3<input type="radio" name="r" value="red"><br><br>
<input type="submit" name="s" value="submit"><br>
<input type="reset" name="r" value="reset"></form><BR>
</td>
</tr>
</table>
</body>
</html>

Ex13:
<html>
<head>
<title></title>
</head>
<body>
<table bgcolor="ffcc000" border="4" bordercolor="blue" width="30%"
align="center">
<tr>
<td>
<form name="f7" action="ex13.php" method="POST">
buton 1<input type="radio" name="r" value="#ffcc000"><br>

21

buton 2<input type="radio" name="r" value="green"><br>


buton 3<input type="radio" name="r" value="red"><br><br>
buton 4<input type="radio" name="p" value="#ffc0000"><br>
buton 5<input type="radio" name="p" value="pink"><br>
buton 6<input type="radio" name="p" value="yellow"><br><br>
<input type="submit" name="s" value="submit"><br>
<input type="reset" name="r" value="reset"></form><BR>
</td>
</tr>
</body>
</html>

Ex14:
<html>
<head>
<title></title>
<style>
form{font-size:24; color:blue;}
select{font-size:24; color:red;}
input{font-size:24; color:green;}
</style>
</head>
<body bgcolor="#ffcc000">
<H1>CULORI:</h1>

22

<form name="f8" action="ex14.php" method="POST">


<h2>Lista de selectie:</h2>
<select name="s" size="3">
<option value="red">rosu</option>
<option value="yellow">yellow</option>
<option value="blue">blue</option>
<option value="green">green</option>
<option value="gray">gray</option>
<option value="pink">pink</option>
</select><br><br>
<input type="submit" value="submit"><br><br>
<input type="reset" value="reset"><br><BR>
</form>
</body>
</html>

Ex15:
<html>
<head>
<title></title>
</head>
<body bgcolor="black">
<H2><FONT COLOR="#FFCC000">FORMULAR:</FONT></H2>

23

<table border="4" bgcolor="#ffcc000">


<form name="f9" action="ex15.php" method="POST">
<tr>
<td>
nume:<input type="text" name="t1"><br><br>
prenume: <input type="text" name="t2"><br><br>
</td>
<td>cursul:
<select size="3" name="s">
<option value="web design">web design</option>
<option value="depanare calculatoare">depanare calculatoare</option>
<option value="grafica puplicitara">grafica publicitara</option>
<option value="contabilitate primara">contabilitate primara</option>
<option value="secretariat informatizat">secretariat informatizat</option>
<option value="engleza">engleza</option>
</select>
</td>
<td>
<br>orar:<br><Br>
08-14<input type="radio" value="08-14" name="r"><br><br>
14-20<input type="radio" value="14-20" name="r">
</td>
<td>
<br>
incepatori<input type="checkbox" name="c1" value="incepatori"><br>
avansati<input type="checkbox" name="c2" value="avansati"><br>
</td>
<td><input type="submit" value="submit" name="buton1"><br>
<input type="reset" value="reset" name="buton 2">
</td><br>
</tr>
</form>
</table>
</body>
</html>

Ex16:
<html>
<head>
<title></title>
</head>
<body bgcolor="#fffc000">
<form name="f10" action="ex17.php" method="POST">
USER<input type="text" name="t1"><br><br>
PAROLA<input type="password" name="t2"><BR><br>
<input type="reset" value="reset"><Br>
<input type="submit" value="submit"> <br>
</form>
</body>
</html>

24

Ex.16 bis:
<html>
<head>
<title></title>
</head>
<body bgcolor="#ffccc000" text="brown">
<B>FORMULAR:</B>
<form name="f10" action="ex16.php" method="POST">
<b>caseta 1</B></B><input type="text" name="t1"><br><br>
<b>caseta2</b><input type="text" name="t2"><BR><br>
<b>caseta3</b><input type="text" name="t3"><Br><br>
<b>caseta4</b><input type="text" name="t4"><br><br>
<input type="reset" value="anuleaza"><Br>
<input type="submit" value="submit"> <br>
</form>
</body>
</html>

25

Ex.17:
<html>
<head>
<title></title>
<style>
#x1
{
color:red;
}
</style>
</head>
<body bgcolor="#fffcccc" text="brown">
<form name="f10" action="ex18.php" method="POST">
<h1>e-mail:</h1><input type="text" name="t1" id="x1"><br><br>
<input type="reset" value="reset"><Br>
<input type="submit" value="submit"> <br>
</form>
</body>
</html>

26

Ex.18:
<html>
<head>
<title></title>
</head>
<body BGCOLOR="#FFCC000" text="blue"> FORMULAR
<form name="f" action="introducere php.php" method="post">
nume <input type="text" name="t1"><br><br>
prenume<input type="text" name="t2"><br><br>
varsta<input type="text" name="t3"><br><br>
telefon<input type="text" name="t4"><br><br>
adresa<textarea name="t5"></textarea><br>
<input type="reset" value="reset"><br>
<input type="submit" value="introducere"><br>
</form>
</body>
</html>

Ex.19 modificare html:


<html>
<head>
<title></title>

27

</head>
<body BGCOLOR="#fffffcc" text="green"><h3><u>FORMULAR:</u> </h3>
<form name="f" action="modificare.php" method="post">
id: <input type="text" name="t1"><br><br>
telefon:<input type="text" name="t2"><br><br>
<input type="reset" value="reset"><br>
<input type="submit" value="introducere"><br>
</form>
</body>
</html>

Ex.20 stergere inregistrare in html:


<html>
<head>
<title></title>
</head>
<body BGCOLOR="#fffffff" text="brown"><h1><u>FORMULAR:</u>
<form name="f" action="stergere inregistrare.php" method="post">
id: <input type="text" name="t1"><br><br>
<br>
<input type="reset" value="reset"><br>
<input type="submit" value="introducere"><br>
</form>
</body>
</html>

28

Ex.21 inregistrare user:


<html>
<head>
<title></title>
</head>
<body>
<form name="f1" action="24 ian ex20 inregistrarea userului.php"
method="POST">
nume:<input type="text" name="t1"><br>
parola:<input type="text" name="t2"><br>
<input type="submit" value="submit"><br>
<input type="reset" value="reset"><br>
</form>
</body>
</html>

29

Ex22:
<html>
<head>
<title></title>
</head>
<body>
<form name="f1" action="24 ian ex20.php" method="POST">
nume:<input type="text" name="t1"><br>
parola:<input type="text" name="t2"><br>
<input type="submit" value="submit"><br>
<input type="reset" value="reset"><br>
</form>
</body>
</html>

30

Ex23 afisare elemente selectate:


<html>
<head>
<title></title>
<script>
function suma(t1,t2)
{
n=t1.value; n=parseInt(n)
s=0;
for(i=1;i<=n;i++)
s=s+i;
t2.value=s;
}
</script>
</head>
<body>
<form>
n=<input type="text" name="t1"><br><br>
suma=<input type="text" name="t2"><br><br>
<input type="button" value="calcul" onclick ="suma(t1,t2)">
</form>
</body>
</html>

31

Ex24 ex java script putere:


<html>
<head>
<title></title>
<script>
function produs(t1,t2)
{
a=t1.value, a=parseInt(a)
b=t2.value, b=parseInt(b)
x=1;
for(i=1;i<=b;i++)
x=x*a;
alert(x);
}
</script>
</head>
<body>
<form>
a:<input type="text" name="t1">
<br>b: <input type="text" name="t2">
<br><input type="button" value="calcul" onClick="produs(t1,t2)">
</form>
</body>
</html>

32

Ex.25 lista alfabetica:


<html>
<head>
<title></title>
</head>
<body>
<ol type="a" start="3">
<li>mere</li>
<li>pere</li>
<li>prune</li>
</ol>
<br> CUMPARATURI:</br>
<table border="1" width="70%" cellspacing="20" align="center">
<tr>
<td rowspan="3">nume si pret</td>
<td>mere</td>
<td>20 lei</td>
</tr>
<tr>
<td>pere</td>
<td>30 lei</td>
</tr>
<tr>
<td>struguri</td>
<td>40 lei</td>

33

</tr>
</table>
</body>
</html>

Ex.26 lista ordonata:


<html>
<head>
<title></title>
</head>
<body>
<table border="1">
<tr>
<td>
<ol type="1">
<li><b>FRUCTE</b></li>
<ul type="square">
<li>mere</li>
<li>pere</li>
</ul>
<li>LEGUME</li>
<ul type="circle">
<li>rosii</li>
<li>cartofi</li>

34

</ul>
</ol>
</td>
<td><img src="poze/lvback.gif"></td>
</tr>
</table>
</body>
</html>

Ex.27:
<html>
<head>
<title></title>
</head>
<body>
<table border="2"width="90%">
<tr>
<td colspan="2"><br></td>
<td><br></td>
<td><br></td>
</tr>
<tr>
<td><br></td>
<td rowspan="3"><br></td>
<td><br></td>

35

<td><br></td>
</tr>
<tr>
<td><br></td>
<td colspan="2"><br></td>
</tr>
<tr>
<td><br></td>
<td colspan="2"><br></td>
</tr>
</table>
</body>
</html>

Ex28 tabel nume si prenume:


<html>
<head>
<title></title>
</head>
<body bgcolor="#ffcc0000">
<table bgcolor="#ffff00" border="4" bordercolor="red">
<tr>
<td colspan="2"><h1>nume si prenume</h1></td>
<td><h1>varsta</h1></td>

36

</tr>
<tr>
<td><br></td>
<td><br></td>
<td rowspan="2"><h1>20</h1></td>
</tr>
<tr>
<td><br></td>
<td><br></td>
</tr>
</table>
</body>
</html>

Ex.29 tabel:
<html>
<head>
<title></title>
</head>
<body bgcolor="#ffcc000">
<h1>TITLU</h1>
<table border="4" bordercolor="red">
<tr>
<td colspan="2" bgcolor="blue"><br></td>
<td><img src="poze/perl.gif"></td>

37

</tr>
<tr>
<td rowspan="2"><font size="5">text</font></td>
<td rowspan="2"><img src="poze/d1.gif"></td>
<td bgcolor="white"><br></td>
</tr>
<tr>
<td bgcolor="blue"><br></td>
</tr>
</table>
</body>
</html>

Ex.31 afisarea datelor:


<html>
<head>
<title></title>
</head>
<body bgcolor="#cccccc">
<form name="f" action="afisarea datelor.php" method="POST">
<input type="submit" value="afisarea datelor"></form>

38

</body>
</html>

Ex31 afisarea unui table in php:


<html>
<head>
<title></title>
</head>
<body bgcolor="#ffcccc">
<form name="f" action="afisarea unui tabel in php.php" method="POST">
<input type="submit" value="afisarea datelor"></form>
</body>
</body>
</html>

39

Ex32:
Ex 33 dictionar:
<html>
<head>
<title></title>
</head>
<body background="poze/BACKGRND.GIF">
<form name="f4" action="dictionar.php" method="POST">
<H1>DICTIONAR:</H1>
<h2>Introduceti cuvantul:</h2><input type="text"name="t1"><br><br>
<input type="submit" value="submit"><br>
<br><input type="reset" value="reset"></form>
</body>
</html>

40

41

You might also like