ko ko 97 Practically a Master Poster

You're overriding everything if post_id exists in URL. Check link 8-10 and 17-20. You're putting old data every time unless your post_id is not include in URL. If 'judul' and 'isi_berita' is empty string currently, they'll always empty every time you tried to update. I don't know why you assign your old data that are issuing on line 17-20. You only need values from form, not from your database to update / insert.

$post_id = $data['post_id'];
$page = $data['page'];
$judul = $data['judul'];
$news = $data['isi_berita'];

You code looks too messy. Have you tested my code ? As I mentioned above, split your create / edit page seperately is better. And put your logic in specific file and that looks more nicer.

ko ko 97 Practically a Master Poster

As cereal pointed out, post_id is missing in form action URL. Append it to your form action as cereal shown above.

However, you should better split different page for create and update process. I made some changes in your code and it should also work fine. It's not tested and use on your own way upon it.

<div id="menu">
      <center>
        <h2>Static Page Manager</h2>
      </center>
      <p>&nbsp;</p>
  <p>&nbsp;</p><center>
      <p>
<?php
    include('../includes/koneksi.php');
    /**
     * Firstly, check if there is post_id in URL, if so, you're editing, if not, you're creating
     */
    $post_id = isset($_GET['post_id']) ? $_GET['post_id'] : '';

    /**
     * Assume post_id provided in URL, then check if the post already exists
     */
    if( $post_id != '' ) {
        $result = mysql_query("SELECT * FROM static_page WHERE post_id =".$post_id) or die(mysql_error());
        $post = mysql_fetch_array($result);
    } else { // not found post
        $post = NULL;
    }

    /**
     * When form submit
     */
    if( isset( $_POST['ok'] ) ) {
        /**
         * Grab data from form. Don't forget to validate them as well
         */
        $news  = isset($_POST['news']) ? $_POST['news'] : '';
        $judul = isset($_POST['judul']) ? $_POST['judul'] : ''; 
        $page  = isset($_POST['page']) ? $_POST['page'] : '';

        /**
         * If post found, then update it
         */
        if( $post != NULL && !empty( $post ) ) {
            $sqlstr = "UPDATE static_page SET page='".$page."', judul='".$judul."', isi_berita='".$news."' WHERE id=".$post['post_id'];

            // Run your query
            $result = mysql_query($sqlstr) or die(mysql_error());

            // Set your message
            $confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";

        } else {
            /**
             * You're creating new post. …
ko ko 97 Practically a Master Poster

seotheo: Here is reference from WP Codex for you. Check it out and try this inside is_paged() conditional block properly as you need.

Always check WP Codex while working with WordPress.

ko ko 97 Practically a Master Poster

The form is using POST method. Every $_GET should change into $_POST

ko ko 97 Practically a Master Poster

String concatenation error on line 15 inside while loop.
echo 'There are . $result . 'members';}

Try this:

$result=mysql_query("SELECT COUNT(*) AS total FROM registration") or DIE(mysql_error());

$row = mysql_fetch_row($result);

if($row[0]['total'] > 0) {
    echo 'There are ' . $row[0]['total'] . ' members.';
}

It should work (not tested).

ko ko 97 Practically a Master Poster

Cart table should has food's ID in case the user order the food and delete from cart table where food's ID and user's ID found.

ko ko 97 Practically a Master Poster

Some mistakes:

$eduser=$_POST['user'];
$edpassword=$_POST['password'];

There is no 'user' and 'password' fields in your form or perhaps, it came from other page ?

$first=isset($_POST['first']);
$last=isset($_POST['last']);
$emai=isset($_POST['ema']);

isset() returns boolean (true / false), not actual values of your first, last, ema fields from the form. The condition should look like this and update query should run inside:

if(isset($_POST['first']) && isset($_POST['last']) && isset($_POST['ema'])) {
    // do your stuff here, validate data, sanitize and run update query
    $first_name = $_POST['first'];
    $last_name  = $_POST['last'];
    $email      = $_POST['ema'];
}

HTML is also invalid, the form is outside of <html> tag. Hopes it help.

ko ko 97 Practically a Master Poster

But, your question doesn't state any PHP process. You just asked to display / hide 'Save/Cancel' button upon 'Edit' button clicked.

ko ko 97 Practically a Master Poster

It can't be stored or what's the problem ? Echo your $qry1 and copy / paste into your MySQL via CLI or PhpMyAdmin and see what happen.

ko ko 97 Practically a Master Poster

This is PHP forum, not Javascript. You can post your problem in Javascript / DHTML forum.

ko ko 97 Practically a Master Poster

Wamp provides to add your own vhosts in seperate folders 'vhosts' under wamp folders, and it'll load all vhosts file you added there when startup wamp server. You don't have to add your VirtualHost in httpd.conf, it makes harder to maintain or you can lost your vhosts configuration when the wamp server has been upgraded.

Try to create your vhost file named 'mysite.local.conf' file in vhosts folder. Add the following directives in your 'mysite.local.conf'.

NameVirtualHost mysite.local:80

<VirtualHost mysite.local:80>
    ServerName mysite.local
    ServerAlias mysite.local

    DocumentRoot "c:/wamp/site2"

    <Directory "c:/wamp/site2">
    Options Indexes FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>
</VirtualHost>

Don't forget to restart your wamp server after your changed has been saved.

Here is complete Apache documentation about VirtualHost and it's related directives.

ko ko 97 Practically a Master Poster

If you know how to work with PHP, MySQL and jQuery or Javascript, that's simple work. The only difficulties would be building pretty UI and the interactive functions on the front-end. The back-end part would be really simple for such kind of work.

ko ko 97 Practically a Master Poster

It should be $result, not $data, the correct one is $numRows = mysql_numrows($result)

Also, you've already assigned student's ID to $student_id variable, why $_GET['id'] in your sql and it was not filter properly. And mysql is deprecated and there is new mysqli and PDO for more secure database communication.

ko ko 97 Practically a Master Poster

What's ajaxObj("POST", "login.php") ? Does your ajax actually working ? You can track Ajax connection on your browser add-on like Firebug.

Are you sure your form data is passed to your Ajax page ? Also there is no </br> tag. It's just <br />

ko ko 97 Practically a Master Poster

I'm not sure what's the problem ? I don't get any problem. Is it not working ?

ko ko 97 Practically a Master Poster

Sounds that you need Ajax. Attach a Javascript event to the links you need to get pagination. Pass some vars to server via Aja which determines to get which data and where.

A Javascript function may look like, in case I juse jQuery for this example.

$.ajax({
    url: 'ajax.php',
    type: 'GET',
    data: {rel: 'something'}, // pass the rel to server and server can serve what to do depends on rel value (country1, country2 etc.)
    beforeSend: function() {
        // before sending Ajax request to server, you may create loading progress here according to your DOM structure
        console.log('Sending to server.');
    },
    error: function(xhr, textStatus, errorThrown) {
        // there is an error returns by server, you can use some DIV to show the error
        console.log('Error: ' + errorThrown);
    },
    success: function(data) {
        // replace your new data into your container
        $('#ajax-container').html(data);
    }
});

In ajax.php

<?php

// get the rel
$rel = $_GET['rel'];

$rel = ( $rel ) ? $rel : 'default_value'; // make sure you've default value

switch( $rel ) {

    case 'country1':
        break;
    case 'country2':
        break;
    default:

}

This is just an example to get an idea, you've to do more work to implement this. Pass also require stuffs for pagination and update them with Javascript upon server response, and so on.

I found out some WordPress functions inside your codes and if you're using WordPress, use WordPress Ajax hook and use it's query functions. It has $wpdb, a global database object to touch with …

ko ko 97 Practically a Master Poster

Seems you've not pass any form data or $_POST['submit'] was not set. What's your page before reaching to 'login.php' ?

And, why session_start() twice ?

ko ko 97 Practically a Master Poster

Can't you write down an JOIN query ? Like below:

SELECT c.*, l.Label AS Location FROM Classifieds AS c JOIN location AS l ON c.Location_id = l.ID WHERE l.Label LIKE '%USA%'
ko ko 97 Practically a Master Poster

Please post your question clearly. Are you talking about more than one record listing with respective pagination for them ?

ko ko 97 Practically a Master Poster

Brackets in where ? Beginning of file name with numbers inside brackets ? I'm not sure what you're actually trying. Below is the modified version of your pattern.

$pattern = '/^(\([0-9]\))?.\w[\w\s\.\%\-\(\)\[\]]*$/u';
ko ko 97 Practically a Master Poster

What's your json file extension ? Have you also put header in your json output file which is 'url' in your script ? Try to set header in your 'url' file with 'Content-type: application/json' or 'Content-type: application/javascript' if you're using javascript file for json data. Example

<?php
$jsonfile = file_get_contents('your_json_file.json'); //in this case .json extension is used
$json = json_encode($jsonfile);
header('Content-type: application/json');
echo $json;
?>
ko ko 97 Practically a Master Poster

Oop ! Sound likes suck! But, you're right. :) Thanks for alert @blocblue.

ko ko 97 Practically a Master Poster

str_pos() returns boolean (TRUE or FALSE). Should be

if (strpos($html->href, 'http://') !== FALSE) {
    //there is http in the url, then do this statement
    // your code
}

Or use @diafol method.

ko ko 97 Practically a Master Poster

Remove your scripts and just check mine, and then, alter those codes according to your needs. You've wrong syntax and also I can't tell without seeing your HTML.

ko ko 97 Practically a Master Poster

Array index start from 0. You can +1 within your array loop. Like

for ($i=0; $i<=$size; $i++)
echo "month number " . ($i+1) . " is :" .$theArray[$i] . "<br />";
}
ko ko 97 Practically a Master Poster
$('#slider').slidertron({

            viewerSelector: '.viewer',

            indicatorSelector: '.indicator span',

            reelSelector: '.reel',

            slidesSelector: '.slide',

            speed: 'slow',

            advanceDelay: 4000

        });

Are you sure this is the correct settings of the plugin ? I just searched and download this plugin. There is documentation inside the package. Check it carefully. It is the original link of the plugin.

ko ko 97 Practically a Master Poster

With my thought, better pick up a CSS framework such Twitter Bootstrap or 960.gs would help you to make your template easily with their default CSS properties in a short while. You can also try free CSS templates to download into your PC and customize those templates according to your needs. Or post your web site link here and then, no one need to download your CSS and everyone can see your CSS via their browser view source and they can also fix your CSS bugs and let you know what you need to do. Good luck. Table layout sucks yet! :)

ko ko 97 Practically a Master Poster

Instead

if($data == $email)

Try

if(in_array($email, $data))
ko ko 97 Practically a Master Poster

In jQuery, you can use $('p').wrap('div'). Anyway, post more details to get more implementation.

ko ko 97 Practically a Master Poster

Here is my script and markup with your getCookie and setCookie functions. It does work properly.

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title> - jsFiddle demo by wasimkazi</title>
    <style type="text/css">
    <!--
    body {
        color: #171717;
        font: 11pt/14pt Arial, Tahoma, Sans-serif;
    }
    h3 {
        font-size: 11pt;
        margin: 0 0 10px;
        padding: 0;
    }
    p {
        margin: 0;
    }
    #boxes {
        margin: 2em;
        width: 300px;
    }
    .button {
        background: #f2f2f2;
        border: 1px solid #aaaaaa;
    }
    .button span {
        cursor: pointer;
        display: block;
        font-weight: bold;
        padding: 0.4em 1em;
    }
    .box {
        border-color: #aaaaaa;
        border-style: none solid solid;
        border-width: 1px;
        display: none;
        margin-bottom: 1em;
        padding: 1em;
    }
    -->
    </style>
    <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
    <script type='text/javascript'>//<![CDATA[ 
    function getCookie(c_name) {
        var i, x, y, ARRcookies = document.cookie.split(";");
        for (i = 0; i < ARRcookies.length; i++) {
            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == c_name) {
                return unescape(y);
            }
        }
    };
    function setCookie(c_name, value, exdays) {
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + exdays);
        var c_value = escape(value) + ((exdays === null) ? "" : "; expires=" + exdate.toUTCString());
        document.cookie = c_name + "=" + c_value;
    };
    $(document).ready(function(){

        if(getCookie('openbox'))
        {
            $('#' + getCookie('openbox')).slideDown('fast');
        }

        $('.button').click(function(o){
            var obj = $(this);
            $('.box').slideUp('fast', function(){
                $(obj).next('.box').slideDown('fast');
                var openBoxID = $(obj).next('.box').attr('id');
                setCookie('openbox', openBoxID);
            });
        })
    });
//]]>  
</script>
</head>
<body>
    <div id="boxes">
        <div class="button"><span>Box 1</span></div>
        <div class="box" id="box1">
            <h3>Box 1</h3>
            <p>Box 1 content.</p>
        </div>
        <div class="button"><span>Box 2</span></div>
        <div class="box" id="box2">
            <h3>Box 2</h3>
            <p>Box 2 content.</p>
        </div>
    </div>
</body>
</html> …
ko ko 97 Practically a Master Poster

See demo here and here

ko ko 97 Practically a Master Poster

If I am not wrong, toFixed() must be custom javascript function which fills zero to float number with one position. You can pass the current value within that function and assign to variable as new value. Like

amount += parseFloat($(this).metadata().amount);
amount = toFixed(amount);
ko ko 97 Practically a Master Poster

If you are comfortable with jQuery, then jquery filter() can be implemented easily.

ko ko 97 Practically a Master Poster

You can now get 'cat_id' in allprod.php by using $_POST['prod'], and then, go with your SQL query to insert that value into table.

ko ko 97 Practically a Master Poster

There are some PHP image resize libraries. Google it.

ko ko 97 Practically a Master Poster

First, where is your radio button ? You just posted only form and submit button. You can process PHP directly with javascript onclick event except using Ajax. You must submit the form and process at server-side then assign value in server-side or print to client-side (browser). Ensure what you want to achieve and post clearly again what you need with your codes.

ko ko 97 Practically a Master Poster

From where do you want to get controller name ? If you want to get from view, you can use $this->uri->segment(1). You can use CI default functions get_instance() to get the current object and then use get_class($CI) to get the object name as string. Example below:

$CI =& get_instance();
echo get_class($CI); // return the current object (i.e, controller name) as string
ko ko 97 Practically a Master Poster

When will you want to insert cat_id ? When the form has submitted ? You must have action to process server-side script. So, put action in your form via "action=somewhere" attribute. Somewhere could be server-side language php / jsp / asp file. Then, you can get the data in this page submitted by form and insert into database table with specific language (PHP-MySQL, ASP-MsSQL, etc.).

ko ko 97 Practically a Master Poster

What are your htaccess currently using ? Post all inside your htaccess. Also, check your apache and phpinfo with 'phpinfo()' within your PHP file. Especially see Loaded Modules to check which modules are being loaded. And post some infos what you gets.

ko ko 97 Practically a Master Poster

Perhaps, you need to have AllowOverride if your hosting provider set by default AllowOverride None You can see details on Apache web site here.

ko ko 97 Practically a Master Poster

Try. This one is working on my localhost.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)[/]?$ $1.php [NC]

This can server what you actaully need. Anyway, have you already check what @pritaeas said.

How about the simplest rewrite:
RewriteEngine On
RewriteRule ^test$ index.php [R=302,NC,L]
If you go to test will it redirect to index.php ? If not even that is working, contact your host to get a working example first.

ko ko 97 Practically a Master Poster

Try. This one is working on my localhost.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)[/]?$ $1.php [NC]

Add below at the bottom of your htaccess to rewrite if theres is no rewrite rule for request, and it'll rewrite to index.htm. You can change index.htm to anything (index.php/asp/jsp) you like to rewrite if rewrite failed.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^(.*) [NC]
RewriteRule ^(.*)$ index.htm

BTW, @diafol, what kind of problem with FTP with uploading htaccess file ? I just wondering to know coz I'm very OK with htaccess and FTP.

ko ko 97 Practically a Master Poster

Change echo "<a href='fullnews.php?id=$id'>$headline</a>"; to echo '<a href="fullnews.php/' . $headline . '-' . $id . '">' . $headine . '</a>';

In htaccess

RewriteEngine On
RewriteRule ^fullnews.php/(.*)-[0-9] fullnews.php?id=$2

It'll rewrite to "fullnews.php?id=123" when visitor visits fullnews.php/headine-123", headline is that you set from query.

ko ko 97 Practically a Master Poster

Try to read the text file via php and echo out instead of using 'include()' function to show the text file.

<?php include($datadir."file_date.txt"); ?>

Instead

<?php include($data_dir . 'read_data.php'); ?>

Read the text file and echo the result in 'read_data.php'. Set file permission for that text file to 755 would be better.

ko ko 97 Practically a Master Poster

It may be cache. Better check file_date.txt directly.

ko ko 97 Practically a Master Poster
var_dump($arraydata['newda']);

How look like the above value before json_decode() function ? It contains any slash or escape ?

ko ko 97 Practically a Master Poster

Set the proper height to DIV.

#comment {height: 300px; overflow: auto}

Will show scroll bar when the content overflow of parent (i.e, more than 300px height).

ko ko 97 Practically a Master Poster

max-height does not work on older IE. You should set fixed height instead of max-height.

ko ko 97 Practically a Master Poster

$stringResult = $stringResult . "['".$resultValue['name']."',".$resultValue['quantity']."],";

The problem is as shown above as bold text. Use another variable to assign. Just like:

$newStringResult[] = $stringResult[$resultValue['name'],$resultValue['quantity']];

The bracket [] defined as array, so, you can get all values within loop as array. Otherwise, you'll only get last value.

ko ko 97 Practically a Master Poster

You must be finding the way to insert multiple rows at a time. Check this post