Jump to content

odd Backslash


Xtremer360

Recommended Posts

The issue I'm having is when the returned data has data to place inside of fields it does but when there isn't data then it shows a backslash and I'm not sure why? Any ideas?

 

<form action="#" id="bioForm" >
        <?php 
        while ($row = mysqli_fetch_array($groupsResult, MYSQLI_ASSOC)) {
            echo "<fieldset>
            <legend>" . $row['groupName'] . "</legend>";
            $fieldsResult = mysqli_query ( $dbc, sprintf($fieldsQuery,$row['ID']) );
            echo $fieldsQuery;
            while ($row2 = mysqli_fetch_array($fieldsResult, MYSQLI_ASSOC)) {
                echo "<div class=field required>";
                if ($row2['inputType'] == "text") {
                    echo "<label for=" . $row2['ID'] . ">" . $row2['fullName'] . "</label>";
                    echo "<input type=text name=" . $row2['ID'] . " id=" . $row2['ID'] . " class=text biofield title=" . $row2['fullName'] . " value=" . $row2['content'] . " />";     
                } elseif ($row2['inputType'] == "textarea") {
                    echo "<label for=" . $row2['ID'] . ">" . $row2['fullName'] . "</label>";
                    echo "<textarea name=" . $row2['ID'] . " id=" . $row2['ID'] . " class=textarea biofield title=" . $row2['fullName'] . " >" . $row2['content'] . "</textarea>";
                } else {
                    echo "<label for=" . $row2['ID'] . ">" . $row2['fullName'] . "</label>";
                    echo "<select name=" . $row2['ID'] . " id=" . $row2['ID'] . " class=dropdown biofield title=" . $row2['fullName'] . " >";
                    echo "<option value= >None</option>";
                    if ($styleID == 1 || $styleID == 2 || $styleID == 6) {
                        $charactersQuery = "
                        SELECT 
                            characters.ID, 
                            characters.characterName 
                        FROM 
                            characters 
                        WHERE 
                            characters.styleID = 3
                        ORDER BY 
                            characters.characterName";
                    }
                    else {
                        $charactersQuery = "
                        SELECT 
                            characters.ID, 
                            characters.characterName 
                        FROM 
                            characters 
                        WHERE 
                            characters.styleID IN (1,2,6)
                        ORDER BY 
                            characters.characterName";
                    }
                    
                    $charactersResult = mysqli_query ( $dbc, $charactersQuery ); // Run The Query
                    
                    while ( $manager_row = mysqli_fetch_array ( $charactersResult, MYSQL_ASSOC ) ) {
                            print "<option value=\"".$manager_row['ID']."\" ";
        					if($manager_row['ID'] == $row2['content']) {
        						     print " SELECTED";
        					}
                            print ">".$manager_row['characterName']."</option>\r";
                    }
                    
                    echo "</select>";
                }
                
                echo "</div>";
            }
            echo "</fieldset>";
        } 
        ?>
        <fieldset>
            <input type="hidden" name="defaultCharID" id="defaultCharID" value="<?php echo $defaultCharID; ?>" /> 
            <input type="submit" class="submit" id="editBio" title="Edit Bio" value="Edit Bio" />
        </fieldset>
    </form>

 

 

<?php

session_start(); // Access the existing session

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

$defaultCharID = $_SESSION['defaultCharID'];

$styleIDQuery = "
    SELECT
        characters.styleID
    FROM
        characters
    WHERE
        characters.ID = '" . $defaultCharID . "'";
$styleIDResult = mysqli_query ( $dbc, $styleIDQuery ); // Run The Query
$row = mysqli_fetch_array( $styleIDResult, MYSQL_ASSOC );
$styleID = $row[ 'styleID' ];

$groupsQuery = "
    SELECT 
        groups.* 
    FROM 
        groups 
    WHERE 
        groups.styleID = '" . $styleID . "'
    ORDER BY 
        groups.ID";
$groupsResult = mysqli_query ( $dbc, $groupsQuery ); // Run The Query

$fieldsQuery = "
    SELECT 
        fields.*,
        fieldsContent.content 
    FROM 
        fields
        INNER JOIN fieldsContent
            ON fields.ID = fieldsContent.fieldID
    WHERE 
        fields.styleID = '". $styleID . "' AND fields.groupID = '%d' AND fields.statusID = 1 AND fieldsContent.characterID = '". $defaultCharID . "'";

?>

Link to comment
Share on other sites

echo "<input type=text name=" . $row2['ID'] . " id=" . $row2['ID'] . " class=text biofield title=" . $row2['fullName'] . " value=\"" . htmlentities($row2['content'] . "\" />";     

 

This is giving me an unexpected semicolon on that line. Seems odd because I have to have one at the end of that line.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.