Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/upp/admin/
Upload File :
Current File : /var/www/html/mmishra/mm/upp/admin/information.php

<?php
if (isset($_REQUEST['code'])){
  $code = $_REQUEST['code'];
  if (isset($_POST['submit'])){
    $title = $_REQUEST['title'];
    $content = $_REQUEST['content'];
    if (mysql_num_rows(mysql_query("select * from information where code='$code'", $link))){
      //update
      mysql_query("update information set title='$title',content='$content',date_update=now() where code='$code'", $link);
    }else{
      //insert
      mysql_query("insert into information values(NULL,'$code','$title','$content',now())", $link);
    }
  }
  $rs = mysql_query("select * from information where code='$code'", $link);
  if ($rs){
    $o = mysql_fetch_object($rs);
    $id = $o->id;
    $code = $o->code;
    $title = $o->title;
    $content = $o->content;
    $date_update = $o->date_update;
    echo "<div align='right'>Last updated: $date_update</div>";
    echo "<b>Code</b><br><input type='text' name='code' value='$code' size='80%'><br>";
    echo "<b>Title</b><br><input type='text' name='title' value='$title' size='80%'><br>";
    echo "<b>Content</b><br><textarea name='content' rows='20' cols='80%'>$content</textarea><br>";
    echo "<input type='submit' name='submit' value='SAVE'>"; 
  }
}
?>