Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    1
    Vote Rating
    0
    samitalways4u is on a distinguished road

      0  

    Question Unanswered: how to Save form value into data base

    Unanswered: how to Save form value into data base


    In "ext-4.0.7" version the file is 'dynamic.html' (full path : ext-4.0.7\examples\form\dynamic.html) does not work. There is (in 'form' folder) save-form.php file is not present, then i create a save-form.php file and it code is...

    save-form.php

    ---------------------------------------------------------------------------------------------------------

    <?php


    $conn = mysql_connect ("localhost", "root", "") or die (mysql_error ());
    mysql_select_db ("extjs") or die (mysql_error ());

    $q=mysql_query ("INSERT INTO `strawhats` (`first`, `last`, `company`, `email`, `time`) VALUES ('".$_POST['first']."','".$_POST['last']."','".$_POST['company']."','".$_POST['email']."','".$_POST['time']."')
    ") or die ('{"success":"false"}');

    // json output to notify the insert is success or not
    if ($q) {
    echo '{"success":"true"}';
    }
    else {
    echo '{"success":"false"}';
    }

    ?>

    ------------------------------------------------------------------------------------------------------------
    please someone help me to do this...

    Thanx...

  2. #2
    Sencha Premium Member tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,695
    Vote Rating
    114
    Answers
    130
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    i can move this to the ext 4 qa section since we don't have any php forums and don't want to have them. without knowing your DB structure we can not really help you except of guessing.

    the only thing that i see directly is that
    echo '{"success":"true"}';

    should be
    echo '{"success":true}';

    (same for false), but this affects just your output.

    another tip: make sure you are submitting via POST if you use the $_POST. If the params get send via get,...
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

Thread Participants: 1