Skip to main content
Code Review

Return to Revisions

2 of 3
pasting code instead of link

The first major app CMS writen

I am looking for a suggestion or advises about some code I have written. I build an online application about 3 month ago the app registers new buildings including description names and so on. The app works perfectly and does what it suppose to. While working on it I was constantly learning and improving my skills. I did include the internal CSS as it was designed specifically for this page but I also used external one as well. I used a lot of ajax, php, and js. I looked at many tutorial and articles while working on this. My main question is

  1. some suggestion toward improving the structure</ br>

  2. is the code similar to something that in a real world in real companies programmer write.</ br>

  3. Is it good for someone who just started it career and the first major web app he is written. Here is a sample file again it all working I do not want you to go thru every line just suggestions.

     <style type="text/css">
     /* demo styles */
     fieldset { border:0; }
     select {
     width: 400px;
     }
     a.ggg{
     color: #003366;
     font-size: x-large;
     font-family: Monotype Corsiva;
     }
     a.gg{
     color: #003366;
     font-size: medium;
     font-family: Monotype Corsiva;
     }
     </style>
     <style>
    

    .darkbg{ background:#ddd !important; } #status{ font-family:Arial; padding:5px; } ul#files{ list-style:none; padding:0; margin:0; } ul#files li{ margin-bottom:2px; width:200px; float:left; } ul#files li img{ max-width:180px; max-height:150px; } .success{ background:#FFCC99; border:1px solid #FF9933; } .error{ background:#f0c6c3; border:1px solid #cc6622; } #button { padding: .5em 1em; text-decoration: none; } #effect { width: 700px; height: 200px; padding: 0.4em; position: relative; } #effect h3 { margin: 0; padding: 0.4em; text-align: center; }

    <link href="styles.css" rel="stylesheet" type="text/css" media="screen" />
    <link type="text/css" href="css/custom-theme/jquery-ui-1.8.5.custom.css" rel="stylesheet" />
    <script type="text/javascript" src="js/ajaxupload.3.5.js" ></script>
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.5.custom.min.js"></script>
    <script type="text/javascript" src="tags.js"></script>
    <script type="text/javascript" src="ui/jquery.ui.core.js"></script>
    <script type="text/javascript" src="ui/jquery.ui.widget.js"></script>
    <script type="text/javascript" src="ui/jquery.ui.position.js"></script>
    <script type="text/javascript" src="ui/jquery.ui.selectmenu.js"></script>
     <script type="text/javascript">
     $(function(){
    

    // gui function for builodin select box gui

     $('select#Building').selectmenu({
     style:'popup',
     maxHeight: 150
     });
     $('select#Building4').selectmenu({
     style:'popup',
     maxHeight: 150
     });
     $('select#Building24').selectmenu({
     style:'popup',
     maxHeight: 150
     });
     });
     //a custom format option callback
    

    // builds gui for tabs $(function() { $( "#tabs" ).tabs(); }); // gui function for buttons $(function() { $( "#search" ).button(); $( "#delete" ).button(); $( "#view" ).button(); $( "#insert" ).button(); $( "#upload" ).button(); $( "#finish" ).button(); $( "#thub" ).button(); $( "#insroom" ).button(); $( "#clearfields" ).button(); $("#date").datepicker(); });

     // ajax Function used to retrive all question runs getallquestions.php
     function allQuestions(){
     $.ajax({
     type: "POST",
     url: "getallquestions.php",
     success: function(html){
     $("#allquestions").html(html);
     }
     });
     }
     // ajax function send date to the getquestionsbydate.php and brings questions 
    function Questionsbydate(){
     $.ajax({
     type: "POST",
     url: "getquestionsbydate.php",
     data: "date=" + document.getElementById('date').value,
     success: function(html){
     $("#allquestions").html(html);
     }
     });
     }
    function deletebuilding(){
    // gets building information 
    

    var x=document.getElementById("Building"); var building=x.options[x.selectedIndex].text; // runs ajax function to delete the building $.ajax({ type: "POST", url: "deletebuilding.php", data: "building=" + building, success: function(html){ $("#deletebuilding").html(html);

     }
     });
     }
     // gets the building information 
     function update(){
     var x=document.getElementById("Building4");
     var building4=x.options[x.selectedIndex].text;
     // ajax function to run the updatebuilding.php
     $.ajax({
     type: "POST",
     url: "updatebuilding.php",
     data: "building4=" + building4,
     success: function(html){
     $("#updateinfo").html(html);
     }
     });
     }
     function insert(){
     // ajax function to run insertbuilding.php
     $.ajax({
     type: "POST",
     url: "insertbuilding.php",
     data: "building2=" + document.getElementById('building2').value +
     "&list2=" + document.getElementById('list2').value+
     "&NoonMap2=" + document.getElementById('NoonMap2').value+
     "&Description2=" + document.getElementById('Description2').value+
     "&bldg2=" + document.getElementById('bldg2').value,
     success: function(html){
     $("#buli").html(html);
     }
     });
     }
     function EMPTY()
     {
     // retrives the building information 
     document.getElementById('building2').value ="" ;
     document.getElementById('list2').value="" ;
     document.getElementById('NoonMap2').value="" ;
     document.getElementById('Description2').value="" ;
     document.getElementById('bldg2').value="" ;
     document.getElementById('buli').innerHTML="";
     }
     // runs funvtion to inset the thumbnail to the database
    function thub(){
     $.ajax({
     type: "POST",
     url: "blobpart11.php",
     data: "building2=" + document.getElementById('building2').value,
     success: function(html){
     $("#thumres").html(html);
     }
     });
     }
    

    // function to run the insert question runs addquestion.php function addquestion(){ $.ajax({ type: "POST", url: "addquestion.php", data: "quest=" + document.getElementById('quest').value + "&ans="+document.getElementById('ans').value, success: function(html){ $("#allquestions").html(html);

     }
     });
     }
     // function for creating button gui and dialog effect 
     $(function() {
     $( "#submit" ).button();
     function runEffect() {
     var selectedEffect = $( "#effectTypes" ).val();
     var options = {};
     $( "#effect" ).show( selectedEffect, options, 500, callback );
     };
     function callback() {
     };
     // set effect from select menu value
     $( "#button" ).click(function() {
     runEffect();
     return false;
     });
     $( "#effect" ).hide();
     });
     function callback45() {
     $( "#effect:visible" ).removeAttr( "style" ).fadeOut();
     };
    

    function insertroom(){ // retrives building information var x=document.getElementById("Building24"); var building24=x.options[x.selectedIndex].text; $.ajax({ // ajax function used to run the addroom specification.php type: "POST", url: "addroomspecification.php", data: "building24=" + $( "#Building24" ).val() + "&Rm_Nm=" + document.getElementById('rm').value+ "&Filled=" + document.getElementById('fill').value+ "&Gender=" + document.getElementById('gen').value+ "&Dimensions=" + document.getElementById('dim').value+ "&Comments=" + document.getElementById('com').value+ "&prcd=" + document.getElementById('prcd').value+ "&bl=" + document.getElementById('bl').value+ "&rest=" + document.getElementById('rest').value+ "&Capacity=" + document.getElementById('cap').value, success: function(html){ $("#room").html(html);

     }
     });
     }
     function clearfilds()
     {
    

    // function for clearing fields document.getElementById('rm').value= "" ; document.getElementById('fill').value="" ; document.getElementById('gen').value= "" ; document.getElementById('dim').value= "" ; document.getElementById('com').value= "" ; document.getElementById('prcd').value= "" ; document.getElementById('bl').value= "" ; document.getElementById('rest').value= "" ; document.getElementById('cap').value= "" ; }

      Home Blog Gallery About
     <div id="logo">
     <img src="images/logo.jpg" width="300" height="180" alt="" />
     </div>
     <br />
     <br />
    <div id="tabs" style="height: 700px; overflow: scroll">
    
    • Search By Key word
    • Search By Specification
    • Modify Building Information
    • Modify Building Information
    • Modifyn







    Add QUESTION

    Please Enter The Question

    Please Enter The Answer

    Blind


    Add Question E-Mail Question Asked
    Question Answer


    <div id="response">
     </div>
    </div>
    
     <?php
    

    $con = mysql_connect("localhost", "root"); if (!$con) { die('Could not connect: ' . mysql_error()); } // retrives the list of buildings mysql_select_db("buildings", $con); $result6 = mysql_query("SELECT Building Name FROM buildingsinfo WHERE Building Name <> '' GROUP BY Building Name ");

    echo "Please select House


    Building Name"; // printing the list box select command

    while($nt6=mysql_fetch_array($result6))

    {//Array or records stored in $nt $hello=$nt6['Building Name']; echo "$hello"; /* Option values are added by looping through the array */ } echo "


    ";// Closing of list box

    ?>



    '' GROUP BY `Building Name` ");

    echo "Please select House


    Building Name"; // printing the list box select command echo "ANY"; while($nt6=mysql_fetch_array($result6))

    {//Array or records stored in $nt $hello=$nt6['Building Name']; echo "$hello"; /* Option values are added by looping through the array */ } echo "


    ";// Closing of list box

    ?>

    <div id="updateinfo"></div>
    

    Step 1 Insert The Building Info

    Building Name

    List No.

    No. on Map.

    Description

    Building Initials




    Step 2 Insert Insert Thubnail





    Step 3 Insert Pictures





    ''"); echo "Please select House


    Building Name"; // printing the list box select command

    while($nt6=mysql_fetch_array($result6))

    {//Array or records stored in $nt $hello=$nt6['Building Name']; echo "$hello"; /* Option values are added by looping through the array */ } echo "


    ";// Closing of list box

    ?> Please Enter Room Number

    Please Enter Building Letter

    Filled

    Please Enter Pricing Code

    Please Enter Capacity

    Please Enter Gender

    Please Enter Dimension

    Please Enter Restriction Name

    Please Enter Comments







    Copyright 2009. Privacy Policy | Terms of Use | XHTML | CSS

    Design by Flash Website Templates

    Design downloaded from free website templates.
user3166
lang-php

AltStyle によって変換されたページ (->オリジナル) /