Bli saya mau tanya kl untuk verifikasi form php. Saya sudah bikin tp mau ditambahkan supaya ketika dia salah, dia tidak usah mengisi dari awal lagi.
<?php
include "incl_db.php";
session_start();
require_once"inc_func_log.php";
$ext = $_SESSION['extension'];
$userid = $_SESSION['user_id'];
$type_user=$_SESSION['type_user'];
$cli = $_SESSION['ss_cli'];
$dnis = $_SESSION['ss_dnis'];
$eventid=$_SESSION['eventid'];
echo"
<form action=sending6.php method=post enctype=multipart/form-data>
<table>
<tr>
<td>Name</td><td> : </td><td><input type=text name=name size=40 style=\" font: arial; font-size: 14px;\"></td>
</tr>
<tr>
<td>Phone Number with STD Code</td><td> : </td><td><input type=text name=phone_number size=40 style=\" font: arial; font-size: 16px;\"></td>
</tr>
<tr>
<td>Nature of Call</td><td> : </td><td><textarea name=message cols=50 rows=5 style=\" font: arial; font-size: 16px; font-weight: bold;\"></textarea></td>
</tr>
<tr><table width=\"100%\"><tr bgcolor=\"#f0f0f0\"><td align=\"center\"><font face=\"arial\" size=4>
Thank you for calling
</b></font></td></tr>
</table>
<br><br><center><input type=submit value=Send name=kirim></center></td>
</form>
";
?>
Kl untuk form prosesnya..
<?php
include "incl_db.php";
print "<body bgcolor=\"#cccc99\">\n";
session_start();
require_once"inc_func_log.php";
$ext = $_SESSION['extension'];
$userid = $_SESSION['user_id'];
$type_user=$_SESSION['type_user'];
$cli = $_SESSION['ss_cli'];
$dnis = $_SESSION['ss_dnis'];
$eventid=$_SESSION['eventid'];
$name = $_POST['name'];
$phone_number = $_POST['phone_number'];
$message = $_POST['message'];
if($_REQUEST['kirim'])
{
if (empty($name))
{
print"<script>alert('Sorry, name must be filled');
javascript:history.go(-1);</script>";
}
else if (empty($phone_number))
{
print"<script>alert('Sorry, phone number must be filled');
javascript:history.go(-1);</script>";
}
else if (empty($message))
{
print"<script>alert('Sorry, message must be filled');
javascript:history.go(-1);</script>";
}else
{
$insert_message="insert into sms_client values ('name','$phone_number','$message',NOW())";
$coba=mysql_query($insert_message);
}
}
if($coba)
{
print "</td></tr>\n";
print "<tr><td><b>Message:</b></td></tr>\n";
print "<tr><td bgcolor=\"#f0f0f0\"><font face=\"courier\">";
print "$message";
print "</font></td></tr></table><br>\n";
print "<br><font size=4>Thank you for call</font><br>";
//include "end_include.php";
print "<hr>";
}else{
echo"The message...";
}
print "<img src=\"images/tunjuk2.png\"><a href=\"end_call.php\">END CALL</a><img src=\"images/tunjuk.png\">";
?>