Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts

    dataString for jquery

    I'm trying to figure out how to do this. I'm trying to figure out how to pass all of the fields that are returned and their status to my jQuery dataString but have no idea how. Any ideas?

    PHP Code:
    <?php

    // Include the database page
    include ('../inc/dbconfig.php');

    $styleid $_GET['id'];
    $query "SELECT  
        fields.fullname,
        fields.enabled
    FROM
        fields
        INNER JOIN styles
            ON styles.id = fields.style_id  
    WHERE
        styles.id = '" 
    $styleid "'";
    $result mysqli_query $dbc$query ); // Run The Query

    ?>

    <script>
    $(document).ready(function() {
        $('div.message-error').hide();
        $('div.message-success').hide();
        $("input.submit").click(function() {
            $('div.message-error').hide();
            var dataString = '&submitbiofields=True';
            $.ajax({
                type: "POST",
                url: "processes/bioconfig.php",
                data: dataString,
                success: function() {
                    $('div.message-error').hide();
                    $("div.message-success").html("<h6>Operation successful</h6><p>Bio fields saved successfully.</p>");
                    $("div.message-success").show().delay(10000).hide("slow", function() {
                        $('#content').load('mods/bioconfiguration.php');  
                    });
                }
            });
            return false;    
         });                                                                  
    });
    </script>

    <!-- Title -->
    <div id="title" class="b2">
        <h2>Bio Configuration</h2>
        <!-- TitleActions -->
        <div id="titleActions">
            <!-- ListSearch -->
            <div class="listSearch actionBlock">
                <div class="search">
                    <label for="search">Recherche</label>
                    <input type="text" name="search" id="search" class="text" />
                </div>
                <div class="submit">
                    <button type="submit" id="search-button" class="button"><strong><img src="img/icons/search_48.png" alt="comments" class="icon "/></strong></button>
                </div>
            </div>
            <!-- /ListSearch -->
        </div>
        <!-- /TitleActions -->
    </div>
    <!-- Title -->
    <!-- Inner Content -->
    <div id="innerContent">
        <!-- Form -->
        <form action="#" id="bioconfigform" >
             <fieldset>
                <legend>Bio Config</legend>
             <?php
                
    while ( $row mysqli_fetch_array $resultMYSQL_ASSOC ) ) {
             
    ?>
                <div class="field">
                    <label for="<?php '' $row['fullname'] . '' ?>"><?php echo '' $row['fullname'] . ''?></label>
                    <input type="radio" value="0" id="<?php echo $row['fullname']; ?>" name="<?php echo $row['fullname']; ?>" class="status"
                      <?php if($row['enabled'] == 0)
                      echo 
    ' checked="checked"';
                      
    ?>
                      />Enabled
                      <input type="radio" value="1" id="<?php echo $row['fullname']; ?>" name="<?php echo $row['fullname']; ?>" class="status"
                      <?php if($row['enabled'] == 1)
                      echo 
    ' checked="checked"';
                      
    ?>
                      />Disabled
                </div>
        
            <?php
            
    }
            
    ?>
                <input type="submit" class="submit" name="submitbiofields" id="submitbiofields" title="Submit Bio Fields" value="Submit Bio Fields"/>
            </fieldset>
        </form>
        <!-- /Form -->
        <!-- Messages -->
        <div class="message message-error">
            <h6>Required field missing</h6>
            <p>Please fill in all required fields. </p>
        </div>
        <div class="message message-success">
            <h6>Operation succesful</h6>
            <p>Bio configuraton was eddited to the database.</p>
        </div>
        <!-- /Messages -->

  • #2
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    Can you post the generated code for the form?
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •