السلام عليكم،
عند اضافة خبر بصورة في نموذج الادخال، احتاج الى كيفية برمجة كود المعاينة والاستعراض قبل الارسال الى القاعدة.
كما هو موجود هنا في المنتدى.
النموذج يحوي زرين : الاول Submit للارسال الى القاعدة مباشرة والثاني زر preview المعاينة لمشاهدة الخبر قبل تغييره او ارساله الى القاعدة.
أرجو اني قدمت القليل من الشرح.
شكراً.
<!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/xhtml" dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>معاينة خبر</title>
</head>
<body>
<?php
if ($_POST) {
$name = $_POST['name'];
$title = $_POST['title'];
$title2 = $_POST['title2'];
$name2 = $_POST['name2'];
$news_head_s = $_POST['news_head'];
$news_s = $_POST['post'];
// ????
$newsimage1 = $_POST['fileupload'];
$newsimage2 = $_POST['imgupload'];
// ????
$titleimg = $_POST['titleimg'];
}
$action = $_REQUEST['action'];
if ($action == "") {
?>
<form name="fpost" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" onsubmit="return checkForm(this)">
<table border="0" width="98%" cellspacing="0" cellpadding="0">
<tr>
<td align="right" class="forum_header">إضافة خبر </td>
<input type="hidden" name="username" value="$name" />
</tr>
<tr>
<td><table border="0" width="100%" id="table13" cellpadding="2" class="fontablt">
<tr>
<td align="right" nowrap="" class="info_bar">الموضوع : <font color="#FF0000">*</font></td>
<td align="right" width="100%"><input type="text" name="title" value="" size="35" class="text_box"></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">عنوان اختياري : </td>
<td align="right" width="100%"><input type="text" name="title2" value="" size="35" class="text_box"></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">المصدر : </td>
<td align="right" width="100%"><input type="text" name="name2" value="" size="35" class="text_box"></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar" valign="top">رأس
الخبر : <br>
اختياري</td>
<td align="right" width="100%"><textarea name="news_head" rows="8" cols="60" onkeypress="return countIt();"></textarea></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar" valign="top">نص
الخبر : <font color="#FF0000">*</font> <br>
طول النص يجب ان يكون <br>
أقل من : 3000حرف<br>
<center>
<a href="#" onmouseover="return proces()">إختبار الطول</a><br>
تبقى لك :
<input size="5" name="remain" type="text" value="$countpost">
<center>
</center>
</center></td>
<td align="right" width="100%">$form_bbcode<br>
<textarea onmouseover="return proces()" onbeforeeditfocus="return proces()" onmouseout="return proces()" name="post" rows="15" cols="60" id="post" wrap="virtual"></textarea>
<input type="hidden" name="left" value="$countpost" size="7" class="text_box"></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">رابط خارجي للصورة :</td>
<td align="right" width="100%"><input type="file" name="fileupload" size="30" /></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">تحميل الصورة من الجهاز :</td>
<td align="right" width="100%"><input type="file" name="imgupload" size="30" /></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">عنوان الصورة :</td>
<td align="right" width="100%"><input type="text" name="titleimg" size="30" /></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><br />
<input name="action" type="submit" value="insert" />
<input name="action" type="submit" value="preview" />
<br />
</tr>
</table>
</form>
<?php
} else if ($action == "insert") {
echo "your insert is done in database";
} else if ($action == "preview") {
//***//
?>
<table border="0" width="98%" cellspacing="0" cellpadding="0">
<tr>
<td align="right" class="forum_header">عرض الخبر </td>
</tr>
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td height="14"><div class="news_title"> <img border="0" src="news_icon.gif" width="12" height="12">$title</div></td>
</tr>
<tr>
<td height="7"><b><font color="#CC0000"> </font> <a href="$news_link"><font color="#CC0000" size="4">$title2</font></a></b></td>
</tr>
<tr>
<td height="7"><b><font color="#CC0000"> <span lang="ar-sa">المصدر</span><span lang="ar-sa">:</span></font><font color="#0066CC"> $name2</font></b></td>
</tr>
<tr>
<td width="100%"><table border="0" cellpadding="2" style="border-collapse: collapse" width="100%" id="AutoNumber1" class="article_info">
<tr>
<td align="right" width="100%"><div class="article_info"> <img border="0" src="info.gif" width="13" height="18"> الكاتب: $name </div></td>
<td nowrap align="left" colspan="3"></td>
</tr>
</table></td>
</tr>
<tr>
<td width="100%" style="padding-top: 5; padding-bottom: 5; text-align: justify"><table align="left">
<tbody>
<tr height="1"></tr>
<tr>
<td width="1"></td>
<td align="center"><img height="200" width="225" align="left" src="$fileupload OR $imgupload" title=""></td>
</tr>
<tr>
<td width="1"></td>
<td align="center"><font size="2" color="#333300">$titleimg</font></td>
<td width="1"></td>
<td></td>
</tr>
</tbody>
</table>
$news_head_s
<hr>
<font class="home_text">$news_s </font></td>
</tr>
</table>
<hr color="#C0C0C0" width="95%" size="1" style="border-style: dotted; border-width: 1px"></td>
</tr>
<form onsubmit="return checkForm(this)" action="news.php?action=insert" method="post" name="rafia" enctype="multipart/form-data">
<table border="0" width="98%" cellspacing="0" cellpadding="0">
<tr>
<td align="right" class="forum_header">إضافة خبر </td>
</tr>
<tr>
<td><table border="0" width="100%" id="table13" cellpadding="2" class="fontablt">
<tr>
<td align="right" nowrap="" class="info_bar">الموضوع : <font color="#FF0000">*</font></td>
<td align="right" width="100%"><input type="text" name="title" value="$title" size="35" class="text_box"></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">عنوان اختياري : </td>
<td align="right" width="100%"><input type="text" name="title2" value="$title2" size="35" class="text_box"></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">المصدر : </td>
<td align="right" width="100%"><input type="text" name="name2" value="$name2" size="35" class="text_box"></td>
</tr>
$txtcounth
<tr>
<td align="right" nowrap="" class="info_bar" valign="top">رأس
الخبر : <br>
اختياري</td>
<td align="right" width="100%"><textarea name="news_head" rows="8" cols="60" onkeypress="return countIt();">$news_head</textarea></td>
</tr>
$editor$txtcount
<tr>
<td align="right" nowrap="" class="info_bar" valign="top">نص
الخبر : <font color="#FF0000">*</font> <br>
طول النص يجب ان يكون <br>
أقل من : 3000حرف<br>
<center>
<a href="#" onmouseover="return proces()">إختبار الطول</a><br>
تبقى لك :
<input size="5" name="remain" type="text" value="$countpost">
<center>
</center>
</center></td>
<td align="right" width="100%">$form_code<br>
<textarea onmouseover="return proces()" onbeforeeditfocus="return proces()" onmouseout="return proces()" name="post" rows="15" cols="60" id="post" wrap="virtual">$post</textarea>
<input type="hidden" name="left" value="$countpost" size="7" class="text_box"></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">رابط خارجي للصورة :</td>
<td align="right" width="100%"><input type="file" name="$fileupload" size="30" /></td>
</tr>
<tr>
<td align="right" nowrap="" class="info_bar">تحميل الصورة من الجهاز :</td>
<td align="right" width="100%"><input type="file" name="$imgupload" size="30" /></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><br />
<input name="action" type="submit" value="Insert" />
<input name="action" type="submit" value="Preview" />
<br />
</tr>
</table>
</form>
<?php
//***//
}
?>
</body>
</html>