PHP - Moved: Unstyled Content Flashing - Is Preloading Css An Option?
This topic has been moved to CSS Help.
http://www.phpfreaks.com/forums/index.php?topic=315351.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=307346.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333152.0 My guess is I'll need a foreach loop with this but I'm a little unclear as to the bigger picture of the foreach because what I need is just foreach CharacterName and CharacterID that belongs to that handler needs to be put into the UL with a id of characterlist with an attached Remove Link to it that will remove it from the UL and append it back into the dropdown. I have something set up like that using jquery but how can I get the character and ID's preloaded into the ID and then afterwards have jquery take over the restwith the remove link and what to do with the appending. Code: [Select] $handlerID = $_GET['id']; $query = "SELECT characters.ID, characters.characterName, handlers.userName, handlers.password, handlers.firstName, handlers.lastName, handlers.email, handlers.isAdmin, handlers.statusID FROM handlers LEFT JOIN handlerCharacters ON handlerCharacters.handlerID = handlers.ID LEFT JOIN characters ON characters.ID = handlerCharacters.characterID WHERE handlers.ID = '" . $handlerID . "'"; $result = mysqli_query ( $dbc, $query ); // Run The Query $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ?> <script type="text/javascript"> $(document).ready(function() { $('div.message-error').hide(); $('div.message-success').hide(); $('ul#characterList').css( 'margin-left', '120px' ); $('li').remove('.characterName'); $("input.submit").click(function() { $('div.message-error').hide(); var handlerID = $("input#handlerID").val(); var userName = $("input#userName").val(); if (userName == "") { $("div.message-error").show(); $("input#userName").focus(); return false; } var password = $("input#password").val(); if (password == "") { $("div.message-error").show(); $("input#password").focus(); return false; } var firstName = $("input#firstName").val(); if (firstName == "") { $("div.message-error").show(); $("input#firstName").focus(); return false; } var lastName = $("input#lastName").val(); if (lastName == "") { $("div.message-error").show(); $("input#lastName").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("div.message-error").show(); $("input#email").focus(); return false; } var statusID = $("select#statusID").val(); if (statusID == "") { $("div.message-error").show(); $("select#statusID").focus(); return false; } var isAdmin = $("select#isAdmin").val(); if (isAdmin == "") { $("div.message-error").show(); $("select#isAdmin").focus(); return false; } var liElements = $("ul#characterList li"); var characterIDList = ""; for( var i = 0; i < liElements.length; i++ ) { var liElement = $( liElements[ i ] ); // only start appending commas in after the first characterID if( i > 0 ) { characterIDList += ","; } // append the current li element's characterID to the list characterIDList += liElement.data( 'characterID' ); } var dataString = 'userName=' + userName + '&password=' + password + '&firstName=' + firstName + '&lastName=' + lastName + '&email=' + email + '&statusID=' + statusID + '&isAdmin=' + isAdmin + '&characterIDList=' + characterIDList + '&handlerID=' + handlerID + '&editHandler=True'; $.ajax({ type: "POST", url: "processes/handler.php", data: dataString, success: function() { $('div.message-error').hide(); $("div.message-success").html("<h6>Operation successful</h6><p>" + userName + " saved successfully.</p>"); $("div.message-success").show().delay(10000).hide("slow"); $(':input','#handlerForm') .not(':submit, :button') .val('') $("ul#characterList").empty(); return true; } }); return false; }); }); </script> <!-- Form --> <form action="#" id="handlerForm"> <fieldset> <legend>Edit Handler</legend> <div class="field required"> <label for="userName">User Name</label> <input type="text" class="text" name="userName" id="userName" title="User Name" value="<?php echo $row['userName']; ?>"/> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="password">Password</label> <input type="password" class="text" name="password" id="password" title="Password" value="<?php echo $row['password']; ?>"/> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="firstName">First Name</label> <input type="text" class="text" name="firstName" id="firstName" title="First Name" value="<?php echo $row['firstName']; ?>"/> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="lastName">Last Name</label> <input type="text" class="text" name="lastName" id="lastName" title="Last Name" value="<?php echo $row['lastName']; ?>"/> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="email">Email</label> <input type="text" class="text" name="email" id="email" title="Email" value="<?php echo $row['email']; ?>"/> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="statusID">Status</label> <select class="dropdown" name="statusID" id="statusID" title="Status"> <option value="">- Select -</option> <?php $query = 'SELECT * FROM statuses'; $result = mysqli_query ( $dbc, $query ); // Run The Query while ( $status_row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { print "<option value=\"".$status_row['ID']."\" "; if($status_row['ID'] == $row['statusID']) { print " SELECTED"; } print ">".$status_row['statusName']."</option>\r"; } ?> </select> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="isAdmin">Administrator</label> <select class="dropdown" name="isAdmin" id="isAdmin" title="Administrator"> <option value="">- Select -</option> <?php $administrator = array('Yes', 'No'); foreach($administrator as $admin): ?> <option value="<?php echo $admin; ?>"<?php if($admin == $row['isAdmin']): echo ' SELECTED'; endif; ?>><?php echo $admin; ?></option> <?php endforeach; ?> </select> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> </fieldset> <fieldset> <legend>Handler's Characters</legend> <div class="field"> <label for="charactersDrop">Characters</label> <select class="dropdown" name="charactersDrop" id="charactersDrop" title="Characters Dropdown"> <option value="">- Select -</option> <?php $query = 'SELECT ID, characterName FROM characters WHERE ID NOT IN (SELECT characterID FROM handlerCharacters) ORDER BY `characterName`'; $result = mysqli_query ( $dbc, $query ); // Run The Query while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { print "<option value=\"".$row['ID']."\">".$row['characterName']."</option>\r"; } ?> </select> <input type="button" value="Add Character" class="" onclick="HandlerCharacters()"/> <ul id="characterList"></ul> </div> <input type="hidden" name="handlerID" id="handlerID" value="<?php echo $handlerID; ?>" /> <input type="submit" class="submit" name="editHandler" id="editHandler" title="Submit Handler" value="Submit Handler" /> </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>Handler was added to the database.</p> </div> <!-- /Messages --> <script type="text/javascript" language="javascript"> // Long version function HandlerCharacters() { function isDupe(which) { var result = false; $('ul#characterList li').each(function(i, e) { if ($(e).data('characterID') == which) { result = true; return false; // break out of .each() } }); return result; } var characterID = $('#charactersDrop option:selected').val(); var characterName = $('#charactersDrop option:selected').text(); if (characterID > 0 && !isDupe(characterID)) { // Create the anchor element var anchor = $( '<a href="#">Remove</a>' ); // Create a click handler for the anchor element anchor.click( function() { $( this ).parent().remove(); return false; // makes the href in the anchor tag ignored } ); // Create the <li> element with its text, and then append the anchor inside it. var li = $( '<li>' + characterName + ' </li>' ).append( anchor ); li.data( 'characterID', characterID ); // Append the new <li> element to the <ul> element $( '#characterList' ).append( li ); } } </script> Hi, I want a page that displays loading content when user logs in, that stays there until all the images on the main page has been preloaded, then redirects to the index page. Is there a way to do this? Stop posting non-PHP questions in the PHP Coding Help section. We have many sub-forums, including both a JavaScript forum and one dedicated entirely to Ajax. This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=327454.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=319085.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=319610.0 This topic has been moved to Website Critique. http://www.phpfreaks.com/forums/index.php?topic=346717.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357949.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319719.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=314750.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=318539.0 Hi, I will start off trying to explain what I am trying to make the best I can. What I want to create is a script that gets the gold value from this website: http://www.lbma.org.uk/pages/index.cfm?page_id=46&title=current_statistics and then save it to a variable which I will use to calculate values of different gold karats. Here is the content in bold I need on the website I linked: Quote LONDON GOLD FIXING USD GBP EUR AM 1588.00 1005.127 1251.083 PM 1589.50 1004.741 1249.803 So what help do I need? Well, I don't expect you to figure out the calculating part for me but some help how to get that content pointed out above and save it to a variable is what I would appreciate getting some help with. I don't know much PHP, only some and I have been trying to figure this out for a day now without any success. I suppose php get contents and/or curl should be used here but I don't know how really. I would very much appreciate the help I can get on this. Thank you! I'm having the strangest thing happing. When posting a form i'm not getting the option value. Instead its posting my text field ie: <option name="1">text</option> Code: [Select] <?php $query = "SELECT id, name FROM locations ORDER BY name"; $res = mysql_query($query, $cid); while($a = mysql_fetch_array($res)) { echo "<option name=".$a["id"].">".$a["name"]."</option>"; } ?> Code: [Select] <?php The code thats grapping it: if($_POST['location']==""){ $location = ""; echo '<div class="message error">Please enter a <strong>Location</strong></div>'; }else{ $location = $_POST['location']; } ?> Can anyone see why? I have also tried it in html to see if its my php, but i get the same result I'm trying to create VIP zone, but I need to check if user has input correct username and password....I tried to make it work this way HTML Code: [Select] <form action="vipchat.php" method="post" /> Korisnicko ime: <input type="text" name="ime"/> Lozinka: <input type="password" name="lozinka"/> <input type="submit" value="Uloguj se"/> </form>php Code: [Select] <?php $imet = "komp"; $sifrat = "racun"; if ($_POST["ime"]==$imet)and($_POST["lozinka"]==$sifrat) echo "Tacno je"; else echo "Netacno je"; ?> But it gives me this error Code: [Select] Parse error: syntax error, unexpected T_LOGICAL_AND in C:\AppServ\www\adm\vipchat.php on line 16 I am using PHP for CV Generator. I need to add an element for 'Add another' option, e.g. on employment section, if you have more than one job you may require to add another form. Would this work with PHP coding? If so, what is it called? If not so, maybe Javascript? I can google for it when I get a answer from you guys. By the way, you may be aware with this- I have a little experience with PHP coding. Dean Do I need to add value to this select statement? Code: [Select] <select id="expYear" name="expYear"> <option></option> <option>2011</option> <option>2012</option> <option>2013</option> <option>2014</option> <option>2015</option> <option>2016</option> <option>2017</option> <option>2018</option> <option>2019</option> <option>2020</option> </select> Debbie how would i render this Code: [Select] <select name="state" value="<?php echo $state; ?>"> <option>Select a state</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District Of Columbia</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> I have a Payment Form that has become rather complex, and I think it's time to hand things off to another page?! Here is the gist of my form... Code: [Select] <?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head></head> <body> <?php // Initialize variables. // ********************************************************************* // HANDLE FORM. // ********************************************************************* if (isset($_POST['submitted'])){ // Initialize Errors Array. $errors = array(); // ******************** // CHECK FORM DATA. * // ******************** // Determine if any errors. if (empty($errors)){ // ********************************************************************* // PROCESS PAYMENT. // ********************************************************************* //@@@@@@@@@@@ START AUTHORIZE.NET CODE @@@@@@@@@@@@@@@@@ // Use HTTP POST to send form data. curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // Print Response Code. switch($response_array[0]){ case "1": $responseCode = 'Approved'; break; case "2": $responseCode = 'Declined'; break; case "3": $responseCode = 'Error (Please contact Customer Service.)'; break; case "4": $responseCode = 'Held for Review (Please contact Customer Service.)'; break; } echo "<br />Response Code: " . $responseCode . "<br />"; //@@@@@@@@@@@ END AUTHORIZE.NET CODE @@@@@@@@@@@@@@@@@@ // Do not return to Payment Form!!! exit(); // ********************************************************************* }// End of PROCESS PAYMENT. }// End of HANDLE FORM. ?> <!-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ --> <!-- HTML PAYMENT FORM --> <form id="payment" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> </form> </body> </html> In fairness, this actually isn't the entire page - it is just the HTML Form and PHP Handling Script... The entire page will also have a Header and Footer, and is why I am asking for help. As my code works no, after the form is submitted, the user sees a white screen with only a Response Message. How can I redirect the user to another page which has my website's Header and Footer and a more personalized message?? (I could technically echo a boat-load of HTML in the IF-THEN-ELSE after the form is submitted, but that seems excessive. So a page re-direct seems to make more sense...) Thanks, Debbie Evening People I have this drop downbox on a HTML page, it is populated from a PHP page, if the user makes a selection i want that selection to be retained once the page refreshed. What i have is while ($row = $db->sql_fetchrow($result)) { if(isset($_GET["REGION_FILTER"]) AND $_GET["REGION_FILTER"] = $row['region'] AND strlen($_GET["REGION_FILTER"]) > 0) //if($region_filter = $row['region'] AND strlen($region_filter) > 0) { $region_filter_options .= '<option value="' . $row['region'] . '" SELECTED>' . $row['region'] . '</option>'; } else { $region_filter_options .= '<option value="' . $row['region']. '">' . $row['region'] . '</option>'; } } REGION_FILTER is the ID of the option box The drop down box is populated from the database but i cant seem to get the selected bit working. Can someone help identify what i have done wrong ? regards |