Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/feed_form.php
<?php
	/*******************************************************************************
     **  File          :  Feed_form.php                                           **
     **  Author        :  G.Ramkumar                                              **
     **  Description   :  Feed Feom												  **
  	 **  Date          :  24/05/2006                                              **
     **  Last Modified :  24/05/2006                                              **
     **  PHP Version   :  5.0.3                                                   **
     *******************************************************************************/
session_start();
include('header.php');

$dropcat_qry="select * from category where type='T' and language='$lang' order by category_name asc";
$drop_res=$pg_sql->query_pass($dropcat_qry,"4");

// *** category
 $dropcat='<select name="category" class="cont" multiple="yes">';
 for($i=0;$i<count($drop_res);$i++)
 {
   if($_REQUEST['category'] == $drop_res[$i][category_id])
      $selected= "selected";
   else
      $selected="";
  $dropcat .='<option class="cont" name="themes" value="'.$drop_res[$i][category_id].'"'. $selected.'>'.$drop_res[$i]['category_name'];

 }
 $dropcat .='</select>';

?>
<script language="javascript">
function checkfeed(){

  var errorMsg = "";
  var errorMsgLong = "Mandatory fields not filled - Please fill all mandatory fields\n";


 	if (document.feed_form.name.value == "")
	{
		errorMsg += "Enter the value for name\n";
	}

 	if (document.feed_form.email.value == "")
 	{
 		errorMsg += "Enter the value for email\n";
 	}
	if (document.feed_form.email.value != "")     
     {
     	if (chkMail(document.feed_form.email.value) == false)
          errorMsg += errorMsg +  "Entered user email is not valid"+"\n";
     } 
 	if (document.feed_form.feed_url.value == "")
 	{
 		errorMsg += "Enter the value for feed url\n";
 	}
	
 	if (document.feed_form.feed_title.value == "")
 	{
 		errorMsg += "Enter the value for feed title\n";
 	}

	var id = new Array();
	var i;
	for (i = 0;  i < document.feed_form.category.length;  i++)
	{
		if (document.feed_form.category[i].selected)
          id[id.length]=document.feed_form.category[i].value
	}
    if(id=='')
	{
 		errorMsg += "Please select atleast 1 themes\n";
	}

 	if((errorMsg != ""))
 	{
 		errorMsgLong += alert(errorMsgLong+errorMsg + "\n");
 		return false;
 	}
    document.feed_form.cat_val.value=id;     
 	return true;
}
</script>
<tr>
  <td width="180" align="left" valign="top">
		<?include("list_categories.php")?>
  </td>
  <td width="600" align="left" valign="top">
      <table width="100%" border="0" align="center" cellspacing="0" cellpadding="0">
		  <tr>
			<td align="left" valign="top" class="bgybluewolineCopy" height="17">&nbsp;&nbsp;<span class="cont_co"><?=$your_?> :</span><a class="contlink" href="http://www.belgium.be/eportal/application?languageParameter=<?=$lang?>"><?=$home_?></a>&nbsp;<img src="images/arrow.gif"><span class="cont_co">Feed Form</span></td>
		  </tr>
     </table>
	 <table cellpadding="0" width="100%" align="center" cellspacing="3" border="0">
		<tr>
		  <td valign="middle" class="heading5" height="25"><?=$feed_form_?></td>
		</tr>
  	  <tr>
		 <td align="center">
		 <form name="feed_form" method="post" action="feed_insert.php">
          <table cellpadding="3" border="0" width="100%" cellspacing="3">
		  <?if($_REQUEST['flag']==1){?>
		    <tr><td class="msg" colspan="2" align="center">Please Enter a valid xml url </td></tr>
		  <?}if($_REQUEST['flag']==2){?>
		    <tr><td class="msg" colspan="2" align="center">Rss Feed already exists in newsmanager site</td></tr>
		  <?}?>

			 <tr>
             <td align="left" valign="middle" class="cont">Name</td>
             <td align="left" valign="top"><input type="text" name="name" value="<?=$_REQUEST['name']?>"></td>
             </tr>
             <tr>
             <td align="left" valign="middle" class="cont">E-mail address</td>
             <td align="left" valign="top"><input type="text" name="email" value="<?=$_REQUEST['email']?>"></td>
             </tr>
             <tr>
             <td align="left" valign="middle" class="cont">Feed url</td>
             <td align="left" valign="top"><input type="text" name="feed_url" value="<?=$_REQUEST['feed_url']?>"></td>
             </tr>
             <tr>
             <td align="left" valign="middle" class="cont">Title of the feed</td>
             <td align="left" valign="top"><input type="text" name="feed_title" value="<?=$_REQUEST['feed_title']?>"></td>
             </tr>
			 <tr>
			 <td nowrap class="cont">Language</td><td>
				<select name="lang" class="cont" onchange="getchanlang();">
					<?php
						$get_lang = "select * from language where lang_id<>'al' order by language_name";
						$lang_result = $pg_sql->query_pass($get_lang,"4");
						$lang_num = count($lang_result);
						for($i=0;$i<$lang_num;$i++){
						   if($lang_result[$i]['lang_id']==$lang){
							  $select = "Selected";
						   }else{
							  $select = "";
						   }
						   echo "<option value='".$lang_result[$i]['lang_id']."' ".$select.">".$lang_result[$i]['language_name']."</option>";
						}
					  ?>
			  </select>
			 </td>
			</tr>
		    <tr>
			  <td class="cont"><?=$adv_themes__?></td>
			  <td><?=$dropcat?></td>
		   </tr>
            <tr>
			<td align="left">&nbsp;</td>
             <td align="left"><input type="hidden" name="cat_val">
			 <input type="image" src="images/<?=$submit_logo?>" alt="submit" name="submit" value="submit" onclick="return checkfeed();"></td>
            </tr>
			</table>
			</form>
           </td>
          </tr>
         </table>
       </td>
	 <td width="187" align="left" valign="top">
		 	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		     <tr>
		       <td align="left" valign="top" class="bgybluewolineCopy" height="19"></td>
		     </tr>
     </table>
     <table border="0" width="100%" height="100%" cellspacing="0" cellpadding="3">
      <tr>
         <td align="left" valign="middle"> <?include('readalso.php')?></td>
     </tr>
   </table>
  </td>
</tr>

<?
include('footer.php');
?>
Return current item: News Manager - RSS aggregator