Monday, June 30, 2014

SEARCH Php Code Search & Display Record in HTML


SEARCH Php Code Search & Display Record in HTML



   
   

        // Find out which form/action we need to load. I have created some
    // hidden input fields to help identifying the forms.
   // echo 'The following data has been submitted:
'; print_r($_POST); echo '
';
    if(!$_POST['form_name'])
    //if(!$_POST['search'])
    {
        //* No search query has been submitted yet. Display the search form.
        ?>
       

           
           

               
                   
                        Search
                   
               
               
                    Enter Search Keyword
                   
                   
               
               
                    Record ID
                    Description
                   
               
           
       
            }
    elseif($_POST['form_name'] == 'search' && $_POST['search'])
    {
        //* The search form has been submitted. Display the update form(s).
        $search = $_POST["search"];
        $result = mysql_query("SELECT * FROM saudi_journal WHERE SO like '%$search%'")or die(mysql_error());
        while($row = mysql_fetch_array($result))
        {
            ?>
           

               
               
                Author
               
                Title
               
                Source
               
                Fulltext Link
               
               

           
                    }
    }
    elseif($_POST['form_name'] == 'update')
{
    //* The update form has been submitted. Update the database.
    // Let's see if we actually arrive at this part:
    $RID = $_POST['RID'];
    $AU = $_POST['AU'];
    $TI = $_POST['TI'];
    $SO = $_POST['SO'];
    $FULTEXT = $_POST['FULTEXT'];
// In your query, $FULTEXT is probably null, or does it get defined somewhere else?
$query = "UPDATE saudi_journal SET AU ='$AU' , SO='$SO', FULTEXT='$FULTEXT' WHERE RID = '$RID'";
//echo 'The query that was executed, is as follows:
' . $query . '
';
mysql_query($query);
$error = mysql_error();
if($error)
    echo $error;
else
    echo "
Successfully Updated in DATABASE
";
    **
// I need the search form back after this messege
}
    ?>



No comments:

Post a Comment