newbies Posted February 17, 2012 Share Posted February 17, 2012 Dear all, i'm using script 2.5 and handle_form.php # 4 with my own code.... HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/bxhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" <content="text/html; charset=utf-8" /> <title>Form Exercise</title> <style type="text/css" title="text/css" media="all"> tanda{ font-weight:bold; color:#300ACC; } </style></head> <body> <form action="handle_form4.php" method="post"> <fieldset> <legend>Masukkan data anda disini</legend> <p><tanda>Nama:</tanda><input type="text" name="nama" saiz="20" maxlength="40"</p> <p><tanda>Email:</tanda><input type="text" name="email" saiz="20" maxlength="60"</p> <p><tanda for="jantina">Jantina :</tanda><input type="radio" name="jantina" value="lelaki"/>Lelaki <input type="radio" name="jantina" value="perempuan"/>Perempuan </p> <p><label><select name="Umur"> <option value="0-29">Bawah 30 Tahun</option> <option value="30-60">30 - 60 Tahun</option> <option value="60+">Melebihi 60 Tahun</option> </select></label></p> <p><tanda>Sebarang komen:</tanda> <textarea name="komen" row="3" cols="40"><textarea></p> </fieldset> <p align="center"><input type="submit" name="daftar" value="Daftar"> </p> </form> </body> </html> PHP <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/bxhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" <content="text/html; charset=utf-8" /> <title>Borang Maklumbalas</title> <style type="text/css" title="text/css" media="all"> .error { font-weight:bold; color:#C00; } error { font-weight:bold; color:#144C85; } </style> </head> <body> <?php # Script 2.4 - handle_form4.php --> dari file test4.html // Membuat versi pembolehubah (variable) dengan script yang padat : if ( !empty($_POST['nama']) && !empty($_POST['komen']) !empty($_POST['email'])){ echo "<p><error>Terima kasih <b>{$_POST['nama']}</b> kerana komen anda <b>{$_POST['komen']}</b>.<br/> Kami akan memberi maklumbalas kepada <b>{$_POST['email']}</b></error></p>\n"; } else { echo '<p class="error"> Sila masukkan semula smula data2 anda.</p>'; } ?> </body> </html> so.... i got this... hope somebody may help.... Thank you in advance.... Link to comment Share on other sites More sharing options...
Larry Posted February 17, 2012 Share Posted February 17, 2012 You're missing the && before !empty($_POST['email']) 1 Link to comment Share on other sites More sharing options...
newbies Posted February 17, 2012 Author Share Posted February 17, 2012 already test... Perfect.... Thank you masta..... Link to comment Share on other sites More sharing options...
Recommended Posts