Jump to content

simeonC

Members
  • Posts

    48
  • Joined

  • Last visited

Posts posted by simeonC

  1. //function numeral(a){
    	
    	raw = 100;
    	var fix =  raw.toFixed(2); //returns 2489.82
    	alert(fix);
    	
    	var too_string= new String(fix);
    	
    	var combine = "$"+too_string;
    	alert(combine);
    	
    	
    	//return(combine);
    	
    //}
    
    
    

    When I remove the comment marks the function toFixed(2) do not work

  2. Just a question can i dynamically set javascript object key:value properties?

    function insert_current() {
    var customer_information = new Object(); //the object which my input form values will be held
    a = document.getElementsByTagName("input"); // gather input tags here
    
    
    /////////////////////////////////// loop through each to get the elements ("input") form name attribute as well as the value.
    			for (i=0; a.length > i; i++){
                    field = a[i].getAttribute("name");
                    value = a[i].value;
                    
                    customer_information.field= value;//this doesn't work
                    var x=document.getElementById("left");
                    x.innerHTML = JSON.stringify(customer_information);
                    }
    				
    				
    ///////////////////////////////////
    				
    	}
    
  3. <div>
                            <ul class="manager_customer_options">
                            
                            
                              <li><button onClick="show_button_content(add_part)">Add Part(s)</button></li>
                                <li><button>Give an Estimate</button></li>
                                  <li><button>Notify Customer</button></li>
                                       <li><button>Print Receipt</button></li>
                                  
                            
                            </ul>
                            </div>
    

    I would like javascript to go through the list and listen for which li element is clicked and load a new div onto my Page Based on which element was clicked. just don't know how to code it.

  4. It is the first thing that is called required ("phpscript/stack_scripts.php") which is

    <?php 
    	session_start();
    	error_reporting(E_ALL);
    	include("connection.php");
    	include("post.php");
    	include("get.php");
    	//include("session.php");
    	//include("signature-to-image.php");
    	//include('addcustomer.php');
    	//include("add.php");
    	//include("charges.php");
    ?>
    
    
    

    and this is included on all pages until the finish product

  5. ok I have a manager.php file which is constructed as such

    <?php 
    require ("phpscript/stack_scripts.php");/// required add customer script
    $title= "Total Auto Clinic";/// Title For page
    
    ?>
    <?php 
    $admin_view=mysql_query("SELECT * FROM repair_orders JOIN (serviced_vechicles) ON repair_orders.car_id=serviced_vechicles.car_id  WHERE repair_status='1'");
    $inshop=mysql_num_rows($admin_view);
    $fetch=mysql_fetch_array($admin_view);
    
    ?>
    
    
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, maxium-scale=1.0, minimum-scale=1.0, initial-scale=1.0"/>
    <meta name="viewport" content="width=device-width">
    <?php include("css_stack.php") ?>
    <title><?php echo $title?></title>
    </head>
    
    <body>
    
    
    <div id="wrapper" >
                    
                    <?php include("structure/header.php") ?>
                    <?php include("structure/nav.php") ?>
                    <?php include("structure/contents.php") ?>
                  	<?php include("structure/footer.php") ?>
    </div>
       
     
     
    
    
    
        
    <?php include("java_stack.php") ?>
    </body>
    </html>

    if the user not logged  in as a manager it will display the login page..

    <?php 
    if (!isset($_SESSION['manager'])){
    	include("content_structures/manager_signin.php");
    	}else{
    		///////////////////////////////////////////////
    if (!isset($_GET['nav'])){
    	echo   "nav is set";
    	include("content_structures/current_service.php");
    	
    	}else {
    		
    		include("content_structures/".$_GET['nav'].".php");
    
    		}
    //it may vary from these three files
    //
    //include("content_structures/rev.php");
    //include("content_structures/update_cars.php");
    //include("content_structures/current_service.php");
    //include("content_structures/update_info.php");
    ///////////////////////////////////////////////
    		}
    	
    
    
    
    
    
    ?>
    

    else depending on which link is clicked that is the content which will display. Current_Service is set a default

     

    the problem that I am having is when I login as the manager and select one of the available links in the nav bar my session is ended and I am returned to the login page. 

    any help will be greatly appreciated..

     

     

  6. I have some JSON data that I retrieved from my database which is suppose to represent customers signatures. However I can now capture it but I cannot display it back on to the canvas field because i do not know how..

    Is there anyone out there that know how to accomplish this task in the  most simpliest way..

    I am currently reading

    document from -- since it is his program

    http://thomasjbradley.ca/lab/signature-pad/#options-ref

    but I cannot seem to get it done

     

    Any help would be appreciated Thank you.

  7. I have inserted some JSON data into mysql database. And would like to retrieve it to display it. However it must first pass through a script..

    My question is how do I convert a php variable to a javascript variable..

     

    The contents of the php variable is

    $signature= [{"lx":123,"ly":37,"mx":123,"my":36},{"lx":120,"ly":33,"mx":123,"my":37},{"lx":119,"ly":33,"mx":120,"my":33},{"lx":113,"ly":33,"mx":119,"my":33},{"lx":102,"ly":33,"mx":113,"my":33},{"lx":92,"ly":33,"mx":102,"my":33},{"lx":81,"ly":32,"mx":92,"my":33},{"lx":71,"ly":31,"mx":81,"my":32},{"lx":67,"ly":30,"mx":71,"my":31},{"lx":63,"ly":29,"mx":67,"my":30},{"lx":62,"ly":27,"mx":63,"my":29},{"lx":62,"ly":25,"mx":62,"my":27},{"lx":65,"ly":20,"mx":62,"my":25},{"lx":78,"ly":13,"mx":65,"my":20},{"lx":98,"ly":4,"mx":78,"my":13},{"lx":114,"ly":0,"mx":98,"my":4},{"lx":167,"ly":4,"mx":114,"my":0},{"lx":172,"ly":9,"mx":167,"my":4},{"lx":175,"ly":15,"mx":172,"my":9},{"lx":177,"ly":23,"mx":175,"my":15},{"lx":179,"ly":34,"mx":177,"my":23},{"lx":179,"ly":40,"mx":179,"my":34},{"lx":179,"ly":46,"mx":179,"my":40},{"lx":179,"ly":49,"mx":179,"my":46},{"lx":177,"ly":54,"mx":179,"my":49},{"lx":176,"ly":54,"mx":177,"my":54},{"lx":175,"ly":55,"mx":176,"my":54},{"lx":173,"ly":55,"mx":175,"my":55},{"lx":171,"ly":55,"mx":173,"my":55},{"lx":169,"ly":55,"mx":171,"my":55},{"lx":169,"ly":53,"mx":169,"my":55},{"lx":169,"ly":52,"mx":169,"my":53},{"lx":170,"ly":51,"mx":169,"my":52},{"lx":172,"ly":50,"mx":170,"my":51},{"lx":173,"ly":49,"mx":172,"my":50},{"lx":175,"ly":48,"mx":173,"my":49},{"lx":176,"ly":47,"mx":175,"my":48},{"lx":178,"ly":46,"mx":176,"my":47},{"lx":175,"ly":45,"mx":178,"my":46},{"lx":167,"ly":45,"mx":175,"my":45},{"lx":158,"ly":45,"mx":167,"my":45},{"lx":147,"ly":45,"mx":158,"my":45},{"lx":136,"ly":45,"mx":147,"my":45},{"lx":125,"ly":45,"mx":136,"my":45},{"lx":118,"ly":45,"mx":125,"my":45},{"lx":111,"ly":45,"mx":118,"my":45},{"lx":107,"ly":45,"mx":111,"my":45},{"lx":104,"ly":45,"mx":107,"my":45},{"lx":103,"ly":45,"mx":104,"my":45},{"lx":108,"ly":43,"mx":103,"my":45},{"lx":123,"ly":40,"mx":108,"my":43},{"lx":139,"ly":38,"mx":123,"my":40},{"lx":156,"ly":37,"mx":139,"my":38},{"lx":168,"ly":35,"mx":156,"my":37},{"lx":176,"ly":35,"mx":168,"my":35},{"lx":180,"ly":35,"mx":176,"my":35},{"lx":181,"ly":35,"mx":180,"my":35},{"lx":44,"ly":17,"mx":44,"my":16},{"lx":46,"ly":16,"mx":44,"my":17},{"lx":47,"ly":16,"mx":46,"my":16},{"lx":56,"ly":16,"mx":47,"my":16},{"lx":65,"ly":16,"mx":56,"my":16},{"lx":78,"ly":16,"mx":65,"my":16},{"lx":91,"ly":17,"mx":78,"my":16},{"lx":101,"ly":18,"mx":91,"my":17},{"lx":109,"ly":19,"mx":101,"my":18},{"lx":117,"ly":21,"mx":109,"my":19},{"lx":121,"ly":21,"mx":117,"my":21},{"lx":126,"ly":21,"mx":121,"my":21},{"lx":128,"ly":21,"mx":126,"my":21},{"lx":129,"ly":19,"mx":128,"my":21},{"lx":130,"ly":19,"mx":129,"my":19},{"lx":131,"ly":18,"mx":130,"my":19},{"lx":139,"ly":18,"mx":131,"my":18},{"lx":151,"ly":19,"mx":139,"my":18},{"lx":165,"ly":23,"mx":151,"my":19},{"lx":178,"ly":26,"mx":165,"my":23},{"lx":188,"ly":28,"mx":178,"my":26},{"lx":197,"ly":29,"mx":188,"my":28},{"lx":205,"ly":29,"mx":197,"my":29},{"lx":210,"ly":29,"mx":205,"my":29},{"lx":214,"ly":29,"mx":210,"my":29},{"lx":217,"ly":26,"mx":214,"my":29},{"lx":219,"ly":24,"mx":217,"my":26},{"lx":219,"ly":22,"mx":219,"my":24},{"lx":219,"ly":18,"mx":219,"my":22},{"lx":219,"ly":15,"mx":219,"my":18},{"lx":219,"ly":13,"mx":219,"my":15},{"lx":219,"ly":11,"mx":219,"my":13},{"lx":218,"ly":12,"mx":219,"my":11},{"lx":218,"ly":14,"mx":218,"my":12},{"lx":218,"ly":17,"mx":218,"my":14},{"lx":218,"ly":21,"mx":218,"my":17},{"lx":218,"ly":26,"mx":218,"my":21},{"lx":218,"ly":30,"mx":218,"my":26},{"lx":217,"ly":33,"mx":218,"my":30},{"lx":216,"ly":36,"mx":217,"my":33},{"lx":216,"ly":37,"mx":216,"my":36},{"lx":215,"ly":37,"mx":216,"my":37},{"lx":215,"ly":36,"mx":215,"my":37},{"lx":213,"ly":33,"mx":215,"my":36},{"lx":212,"ly":30,"mx":213,"my":33},{"lx":208,"ly":28,"mx":212,"my":30},{"lx":200,"ly":27,"mx":208,"my":28},{"lx":192,"ly":27,"mx":200,"my":27},{"lx":184,"ly":27,"mx":192,"my":27},{"lx":174,"ly":29,"mx":184,"my":27},{"lx":164,"ly":32,"mx":174,"my":29},{"lx":152,"ly":35,"mx":164,"my":32},{"lx":142,"ly":38,"mx":152,"my":35},{"lx":134,"ly":41,"mx":142,"my":38},{"lx":129,"ly":42,"mx":134,"my":41},{"lx":124,"ly":43,"mx":129,"my":42},{"lx":120,"ly":44,"mx":124,"my":43},{"lx":118,"ly":44,"mx":120,"my":44},{"lx":116,"ly":44,"mx":118,"my":44},{"lx":116,"ly":45,"mx":116,"my":44},{"lx":116,"ly":50,"mx":116,"my":45},{"lx":116,"ly":56,"mx":116,"my":50},{"lx":116,"ly":60,"mx":116,"my":56},{"lx":114,"ly":63,"mx":116,"my":60},{"lx":111,"ly":65,"mx":114,"my":63},{"lx":106,"ly":66,"mx":111,"my":65},{"lx":103,"ly":66,"mx":106,"my":66},{"lx":98,"ly":66,"mx":103,"my":66},{"lx":95,"ly":66,"mx":98,"my":66},{"lx":91,"ly":64,"mx":95,"my":66},{"lx":86,"ly":62,"mx":91,"my":64},{"lx":83,"ly":60,"mx":86,"my":62},{"lx":80,"ly":58,"mx":83,"my":60},{"lx":78,"ly":56,"mx":80,"my":58},{"lx":76,"ly":55,"mx":78,"my":56},{"lx":75,"ly":53,"mx":76,"my":55},{"lx":75,"ly":51,"mx":75,"my":53},{"lx":75,"ly":50,"mx":75,"my":51},{"lx":75,"ly":49,"mx":75,"my":50},{"lx":75,"ly":47,"mx":75,"my":49},{"lx":77,"ly":47,"mx":75,"my":47},{"lx":79,"ly":47,"mx":77,"my":47},{"lx":81,"ly":47,"mx":79,"my":47},{"lx":82,"ly":47,"mx":81,"my":47},{"lx":84,"ly":47,"mx":82,"my":47},{"lx":84,"ly":48,"mx":84,"my":47},{"lx":85,"ly":48,"mx":84,"my":48},{"lx":86,"ly":49,"mx":85,"my":48}]
    

    This is how the data will comeout of the database now how do I get it back into javascript

  8. Issue I have a form which is submitted and entered to a database like all forms. The problem begins when I started using form elements outside of the form tags.

     

    as such

    <form action="shopfunction.php?repair_id=<?php echo urlencode($_SESSION['repair_id']) ?>" id="customer_info" method="post"  name="customer_info">
     <td align="center"><input type="text" name="tag" autocomplete="" value="<?php echo $customer_info['tag']?>"></td>
                <td align="center"><input type="text" name="vin" autocomplete="" value="<?php echo $customer_info['vin']?>"></td>
                <td align="center"><input type="text" name="miles_in" autocomplete="" value="<?php echo $customer_info['miles_in']?>"></td>
                <td align="center"><input type="text" name="miles_out" autocomplete="" value="<?php echo $customer_info['miles_out']?>"></td>
    </form>
    --------------------VVVVVVV-------------------These are outside the form tag----------However have the form id attribute to be recognised------------VVV
     <td align="left">Sublet/Others</td>
                <td align="left"><input type="text" name="others" size="10" form="customer_info" value="<?php echo $display_other;?>"></td>
              </tr>
              <tr>
                <td align="left">***Shop Supplies</td>
                <td align="left"><input type="text" name="supplies" size="10" form="customer_info" value="<?php echo $display_supply ?>"></td>
              </tr>
              <tr>
                <td align="left">***Fees</td>
                <td align="left"><input type="text" name="fees" size="10" form="customer_info" value="<?php echo $display_fees; ?>"></td>
    

    I have no idea why may be you guys can help me. Have my php script recognise these elements as form elements

     

  9. well since everyone seemed to overlook my post. Not to sure if it was hard to understand. I will just post my answer to my own post.
    $payment_method=$_POST['payment_method'];//the check box array from forum
    	$payment_count=count($payment_method);//count of elements in the array
    	list($a, $b, $c) = ($payment_method); // use the list function to take each value and place them into a variable in the following order these variables are used in my query. 
    
    //if no checkboxes are selected we do nothing 
    
    //if you one item has been selected we perform the following action//
    
    
    if ($payment_count==1) { $query_count=mysql_query("SELECT * FROM payment_option WHERE repair_id='$_SESSION[repair_id]'");
    $count=mysql_num_rows($query_count);//we count the option in the database to see if it exist
     
    ///if not we insert the checked elements into the data base
    if ($count==0){$insert_options=mysql_query("INSERT INTO payment_option (repair_id,`$a`) VALUES ('$_SESSION[repair_id]','$a')");}
     
    ////if there is an item in the database already we delete it and insert the new options
    if ($count>0){$delete_query=mysql_query("DELETE FROM payment_option WHERE repair_id='$_SESSION[repair_id]'");
    $insert_options=mysql_query("INSERT INTO payment_option (repair_id,`$a`) VALUES ('$_SESSION[repair_id]','$a')");
     
    }
     
    }
    ///Here the same logic above is used same format for the next two options just added the listed variables into the query
    elseif ($payment_count==2){
    $query_count=mysql_query("SELECT * FROM payment_option WHERE repair_id='$_SESSION[repair_id]'");
    $count=mysql_num_rows($query_count);
     
    if ($count==0){$insert_options=mysql_query("INSERT INTO payment_option (repair_id,`$a`,`$b`) VALUES ('$_SESSION[repair_id]','$a','$b')");}
     
    if ($count>0){$delete_query=mysql_query("DELETE FROM payment_option WHERE repair_id='$_SESSION[repair_id]'");
    $insert_options=mysql_query("INSERT INTO payment_option (repair_id,`$a`,`$b`) VALUES ('$_SESSION[repair_id]','$a','$b')");
    }
     
    }
    elseif  ($payment_count==3){
    $query_count=mysql_query("SELECT * FROM payment_option WHERE repair_id='$_SESSION[repair_id]'");
    $count=mysql_num_rows($query_count);
     
    if ($count==0){$insert_options=mysql_query("INSERT INTO payment_option (repair_id,`$a`,`$b`,`$c`) VALUES ('$_SESSION[repair_id]','$a','$b','$c')");}
    if ($count>0){$delete_query=mysql_query("DELETE FROM payment_option WHERE repair_id='$_SESSION[repair_id]'");
    $insert_options=mysql_query("INSERT INTO payment_option (repair_id,`$a`,`$b`,`$c`) VALUES ('$_SESSION[repair_id]','$a','$b','$c')");
    }
     
    }
     
    I just have a feeling that there was a shorter way to do this if so please post so i can learn as I age thank you

     

     

     

  10. Here I have three form elements

    <td colspan="6">Intended Payment Method 
            
    <input type="checkbox" name="payment_method[]" id="checkbox" value="cash">      
    Cash
    <input type="checkbox" name="payment_method[]" id="checkbox2" value="check">
    Check 
    <input type="checkbox" name="payment_method[]" id="checkbox3" value="credit/debit">
    Credit/Debit
    </td>
    

    I would like to insert them into a database with the following conditions, however I have no idea how to construct these conditions.

    Condition 1: if there is no records which indicate the Intended payment method Insert that which have been checked.

    Condition 2: if there is a record for the customer which indicates an intended payment method and the user is attempting to change these settings using the same fields.

      -Check what payment method have been inserted the mysql database

      -Check if the new payment methods inserted match whats in the database; if so do nothing to that row

    if the option has been unchecked or checked update the database to meet that condition

     

    As you can see below I have not gotten far because I am fluent with php to that which you would consider mastery. Any help will be greatly appreciated.

    if (isset($payment_method) && is_array($payment_method)) { 
    	$count_insert=count($payment_method);
    	$payment_count_query=mysql_query("SELECT * FROM payment_option");
    	$count_query=mysql_num_rows($payment_count_query);
    	echo $count_query; echo $count_insert;
    	
    	if ($count_query==0){
    		foreach ($payment_method as $value){
    			$insert_method==mysql_query("INSERT INTO payment_option (repair_id,payment_method) VALUES ('$_SESSION[repair_id]','$value')");
    			}//end foreach statment where query count equals 0
    		}//end of queyr count
    	
    	if ($count_query>0){
    		
    		foreach ($payment_method as $value){
    			
    			while ($payment_fetch=mysql_fetch_array($payment_count_query)){
    				if ($payment_fetch['payment_method']==$value){}else{
    					mysql_query("UPDATE payment_option SET ");
    					
    					}/// I was lost at this point because I can see the outcome not being what I had in mind///////
    				
    				}
    			
    			}///end foreach statement count_query<0
    		
    		
    		}//end if statment for query count==1
    	   
    }//end of if payment method was set
    
×
×
  • 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.