İf else Komutları:

Örnek:

<?php
$ana="1";
if($ana>12){
echo 'selam';
}
else
{
echo 'yanlış';
}
?>

html veri gönderme ve phpnin değeri okuması

Örnek:

html kodları:

<form action="test.php" method="get">

<input name="deger1" type="text" />

<input type="submit" value="veri gönder" /></td>

</form>

php kodları:

<?php
$deger1 = $_GET["deger1"];

echo $deger1;

?>

mysql bağlantısı

Örnek:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_baglantim = "localhost";
$database_baglantim = "database";
$username_baglantim = "root";
$password_baglantim = "";
$baglantim = mysql_pconnect($hostname_baglantim, $username_baglantim, $password_baglantim) or trigger_error(mysql_error(),E_USER_ERROR);

mysql_connect("$hostname_baglantim", "$username_baglantim","$password_baglantim")
or die ("Veritabanına bağlanamadı");
@mysql_select_db("$database_baglantim")
or die("Veritabani bulunamadı");
?>

 

İnclude Fonksiyonları:

Örnek:

<? php include 'test.php'; ?>

 

Alert (Devam etsin mi) Uyarısı:

Örnek:

<script type="text/javascript">
function onay() {
return confirm ('Kaydı Silinsinmi?.\n')
}
</script>

<a onclick = "return onay()" href="test.php"> Tıkla </a>