Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1

    Default PHP insert mess on IE8


    Hi mga master ,, newbie pko sa php.. ask unta ko unsa ang solution ani nya. nag google ko wla man.. bsin kamo ra mka tubag ani akong question. IF FF nga browser akong gamiton ang insert nga statement working good cya.. mo add cya sa gusto nkong e pa add.. but if IE8 akong gamiton mo add hnuon cya pro duha ka buok record den ang ika duha kay blank ra ang auto incremented ra ang naay value sa mga columns.. Working rman jud ang insert nga code ang problem lng kai y duha ang e add sa IE8 den ok rman sa FF. MySQL akong db

    Code:
    <?php
    $con = mysql_connect("localhost","root","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("dbname", $con);
    
    $sql="INSERT INTO tblName(name, location, budget, information, howtoget, nottomissed) VALUES('$_POST[name]','$_POST[location]','$_POST[budget]', '$_POST[addinfo]', '$_POST[howtoget]', '$_POST[missed]')";
    mysql_query($sql,$con);
    mysql_close($con);
    ?>
    wla pa na nko ma sanitize akong connection code.. katOn2 ra ni ako..

  2. #2
    weird, the reason why google didn't come up with some answers because I think php/cgi scripts are processed on the server itself and not in browsers.

    I really have no idea how your browser caused the issue.

    Maybe you did trigger those line of codes twice in your client script;

  3. #3
    Sa form daw dapit bai e post ang code.

  4. #4
    post daw imo form bai, akip sad javascript kung ni gamit ka

  5. #5
    Quote Originally Posted by Dondon View Post
    Sa form daw dapit bai e post ang code.
    exactly.........

  6. #6
    In this kind of issue, don't blame the BROWSER.

    Your code should be like this
    Code:
    $sql="INSERT INTO tblName(name, location, budget, information, howtoget, nottomissed) 
    
    VALUES(\"".mysql_escape_string($_POST[name])."\",
              \"".mysql_escape_string($_POST[location])."\",
              \"".mysql_escape_string($_POST[budget])."\",
              \"".mysql_escape_string($_POST[addinfo])."\",
              \"".mysql_escape_string($_POST[howtoget])."\",
              \"".mysql_escape_string($_POST[missed])."\" ); ";
    MY EXPLAINATION:
    *Proper use of escape characters like " into \" \ into \\ .... etc
    *Proper use of concatenations. This is safe for passing variables as a string.
    - remember PHP do not support ARRAY variables pass directly as string... unlike normal variable does.
    *mysql_escape_string built-in function prevents SQL injection.


    since your variable is using double quotes. You should "escape" double quotes as well.
    If your variable is using single quotes, You escape single quotes sometimes but you have to be careful.
    Last edited by dodie; 11-19-2010 at 12:27 PM.

  7. #7
    huh? hmm... its very rare that PHP had browser issues... it runs on the server not on the browser...

    check your JS and HTML Form ....

  8. #8
    Posible kaduha nag postback na imong browser..

    butangi ug validation ang imong posting nga kung empty ang value dili sya mo insert..

  9. #9
    Quote Originally Posted by salbahis View Post
    huh? hmm... its very rare that PHP had browser issues... it runs on the server not on the browser...

    check your JS and HTML Form ....
    checking the form also helps... to be straight forward and easy, just use this code:
    Code:
    print_r($_POST);
    print_r($_GET);
    
    // or...
    print_r($_REQUEST);
    The purpose of this is to see the receiving side which variable are available to accept.

  10. #10
    salamat mga master.. ako ning e try inyong mga inputs dri.. later nlng ko mag butang sa form code.

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. We make rich web applications in PHP or Ruby on Rails + Jquery
    By Adones Pitogo in forum Websites & Multimedia
    Replies: 0
    Last Post: 02-28-2013, 11:29 AM
  2. PHP+MySQL+Apache on Pentium 3
    By GuyVeR in forum Programming
    Replies: 8
    Last Post: 06-23-2011, 10:25 PM
  3. Need help on PHP
    By Badekdek in forum Programming
    Replies: 8
    Last Post: 01-26-2009, 09:19 PM
  4. Need help on PHP
    By Badekdek in forum Programming
    Replies: 1
    Last Post: 01-20-2009, 07:54 AM
  5. Need help on PHP
    By Badekdek in forum Networking & Internet
    Replies: 0
    Last Post: 01-19-2009, 11:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top