<?php

	include "library.php";

    $cxn = start_code();


	if (val( $_POST, "password" ) != "IndieHair12$" )
	{
	    echo black( "<br>Incorrect system password<br><br>" );
	}
    else
    {
        for ($i=1; $i <= 100; $i++)
        {
            $heading_bold = val( $_POST, 'heading_bold'.$i );
            
            $service_description = val( $_POST, 'service_description'.$i );
            
            $service_price = val( $_POST, 'service_price'.$i );
            
            if ($service_price == "")
                $service_price = "NULL";
                
            $query = "UPDATE services SET heading_bold = '".$heading_bold."', description = '".$service_description."', price = ".$service_price." WHERE number = ".$i;
            
    		$result = run_query( $query, $cxn );
        }
        
        echo "<br><br>";
        
        echo black( "Changes saved<br><br>" );
    }
    
    echo "<a href='/'>Home page</a>";
    
?>    