ko ko 97

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

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

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

$('#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.

din3sh commented: i downloaded one readymade css template with the layout that i found appropriate but with a slider just a splash image http://www.freecsstemplates.org/preview/rifle/ .. n another with a slider .. so i was trying to replace the image with the slider http:/ +0

ko ko 97

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

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

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

$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

Probably, you may have XMLHTTPRequest problem. Are you sure crearXMLHttpRequest() works on IE and you get new XMLHTTPRequest ? Should try what @pritaeas said.

ko ko 97

[B]select * from [COLOR="Red"]emp1[/COLOR][/B], make sure that table name is correct, emp with 1 or l ?

ko ko 97

Probably, $get has NULL. Check the query again. And are you sure that the connection succeed ? Make sure your mysql_connect passed or not. Anyway, use the error handler.
[code]
mysql_connect($host, $user, $pass) or die('Couldn\'t connect to MySQL. Error: ' . mysql_error());
[/code]
[B]SELECT * FROM songs[/B], check this query manually in PHPMyAdmin via the browser.

ko ko 97

[B]session_start()[/B] should be very top of the file before returning any HTML output and should not have empty line or space between php opening tag and session_start(). Move 'session_start()' before any html tags. Below is the valid format.
[code=php]
<?php
session_start();
?>

Contact Us
Home

Thanks for showing interest in 3E Solutions.

Kindly fill all the required fields. We will get in touch with you within 24 hours.

 

*Name:

*Email Address:

Phone No:

Interseted in:

          

*Enter Code:

ko ko 97

[QUOTE] " <div class=\"shopping_cart\">
<div class=\"cart_title\">Shopping cart

        <div class=\"cart_details\">Items 
      echo  $_SESSION['Items'];  <br />   /// this line has error
        <span class=\"border_cart\"></span>
        Total: <span class=\"price\">echo $_SESSION['Price']; </span>      ////this line has error also
        </div>

        <div class=\"cart_icon\"\><a href=\"#\" title=\"header=[Checkout] body=[&nbsp;] fade=[on]\"><img src=\"images/shoppingcart.png\" alt=\"\" title=\"\" width=\"48\" height=\"48\" border=\"0\" /></a></div>

    </div>";[/QUOTE]

Wrong syntax. Try with below:
[code=php]
echo "<div class=\"shopping_cart\">\n
<div class=\"cart_title\">Shopping cart\n

        <div class=\"cart_details\">Items " . $_SESSION['Items'] . "<br /><span class=\"border_cart\"></span>
        Total: <span class=\"price\">" . $_SESSION['Price'] . "</span>\n
        </div>\n            
        <div class=\"cart_icon\"\><a href=\"#\" title=\"header=[Checkout] body=[&nbsp;] fade=[on]\"><img src=\"images/shoppingcart.png\" alt=\"\" title=\"\" width=\"48\" height=\"48\" border=\"0\" /></a></div>\n
    </div>\n";

[/code]
'[B]\n[/B]' for line feed. It will force to appear HTML tag from the new line in the source code.

ko ko 97

Try this:
[code]

My first PHP By my own

[/code]
You should not have the plain text directly between the head tags. You can do in body tags. Also, you must write semi-colon ';' at the end of every PHP statements.

karthik_ppts commented: useful +5

ko ko 97

It's not important if the user turn-off javascript or not. You might check from the server-side at least for the security reasons like mysql injection.

Xufyan commented: xufyan :) <3 +3

ko ko 97

@twiss, thanks man. You're right, I forgot it.

ko ko 97

OK. I'm not XML expert. But I can do a little bit like following.
[code]
<?xml version="1.0"?>

XML $3.0 HTML $4.0

[/code]
As understanding your table, you've only two title, and price for each book. You can add addition element such [icode]23232Jun-28-2012[/icode], ISBN number and the published date of the book as you like.
Hope that it will appreciate for you.

ko ko 97

Sorry! It is wrong. Here is correct one.
[code]
$sql .= ($i == (count($check)-1)) ? " $check[$i]" : " $check[$i],";
[/code]
Echoing the query string on the browser, before executing is good practice. You'll see your query is properly collect or not. And you can copy and paste this string into your phpMyAdmin and can see how the query shows.
Hope this help!

ko ko 97

Group the checkbox with the unique name like @IIM method. But, you don't need many query within the loop. It is unnecessarily extra process. Try this:
[code]
if(isset($_POST['submit'])){
$sql = "SELECT";
$check = (array) $_POST['a'];
for($i = 0; $i < count($check); $i++) {
//assign the query string
$sql .= ($i <= count($check)) ? " $check[$i]" : " $check[$i], ";
}
//concatenate the require strign for query
$sql .= " from tbl_hindi";
//execute the query
$query = mysql_query($sql);
}
[/code]
As you see, the query string will concatenate within the loop with the amount of the check-box which are already checked by the users. There is no problem even if you don't have 'SELECT ', when all check-boxes was checked. In this condition, the query string will be [code]SELECT name, address, mobile, dob, namdan_date[/code]. It's similar to 'SELECT ' if your table was built with these fields.
Also, line 11, you've this code.
[QUOTE]

IIM commented: Nice work...i was thinking something similar but can't conclude to exact point.... +2

ko ko 97

What value are you meaning ? This one [icode]$sector=$_GET['sec'];[/icode] ?
Your question is not clear.

ko ko 97

I started from there.[URL="http://www.html.net/"] http://www.html.net/[/URL]
And here is the good place for CSS design [URL="www.csszengarden.com"]www.csszengarden.com[/URL].

Start from basic, and go professional. Below is the simple road map.
HTML+CSS+Js => PHP/ASP.Net/JSP/Framework

Enjoy with your learning.

ko ko 97

[QUOTE]$query = "UPDATE account SET account_type = '$atype', fd_period = 'fdper' WHERE account_number= anum";[/QUOTE]
Are you using this statement ? 'anum' should be '$anum'.

diafol commented: good spot +13

ko ko 97

Is '$pd_image' already has absolute URL including your host, domain (e.g., [url]www.example.com/images/image.jpg).If[/url] so, let me do it:
[code]

ko ko 97

It doesn't work with relative URL, I tested it. Use by following.
[CODE]yoursite_url/resize.php?width=180&height=180&image=yoursite_url/image_path/image[/CODE]
No slash '/' after the 'resize.php'. Use '?' and parameters follow by that. The above is correct way.
Hope this help.

ko ko 97

@MrDJK, you're right.
@Jaklins, IE has different known for MIME-TYPE. You'll probably know that echo the file type. IE shows 'jpg' as 'pjpeg' and 'png' as 'x-png'. So, the upload will be done with adding a few lines for those MIME types.
[code]
$_FILES["fileField"]["type"] == "image/pjpeg" //for jpeg, and jpg
$_FILES["fileField"]["type"] == "image/x-png" //for png
[/code]
Hope that solve, and credit to MrDJK.

MrDJK commented: Thanks for elaborating more. (: +1

ko ko 97

Try this:
[code]
<?php
$year = 2011;
$selectedYear = isset($_POST['year_nam']) ? $_POST['year_nam'] : $year; // If you use GET method use $_GET['year_nam'] instead of $_POST['year_nam']
?>

ko ko 97

You can escape HTML from the PHP delimiter and echo the value in their specific ''. Example below:
[code]
<? php
/ Shuawna Norris
June 13, 2011
Part two
Working with money
/

$balance=55.75;
$newShirtCost=15.75;
$earns=20.00;
$bar=.55;
?>

Balance
”; Starting balancebalance Purchase: Clothing Store: ATM Deposit: Balance after split with wife:

[/code]
This is more readable and easy to maintain.

karthik_ppts commented: helpful +4

ko ko 97

Post the error message you got.

vedro-compota commented: +++++++= +3

ko ko 97

[CODE]

[/CODE]
Try with above. It works on my PC.

ko ko 97

[QUOTE][/QUOTE]
Replace above with below one:
[code]

[/code]

almostbob commented: good eyes zero +13
Zagga commented: Well spotted +5