Clickable links in PHP

Sorry about the continuous questions guys but I have another small issue, when I click the submit button to post the information in the for to that database nothing happens.

This is the form
PHP:
 <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
   <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 

  <script>


  function focusTextBox(){
  var a=2;
 var tb = document.getElementById('datepicker');
 if(a==2){
 $(document).ready(function() {
    $( "#datepicker" ).datepicker({ minDate: 0, maxDate: "+18M +0D", showOtherMonths: true,
      selectOtherMonths: true, dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],showButtonPanel: true, dateFormat: 'yy-mm-dd' });
  });
}else{

 $(document).ready(function() {
    $( "#datepicker" ).datepicker({ minDate: 1, maxDate: "+18M +0D", dateFormat: 'yy-mm-dd' });
  });

}
 tb.focus();



}
  </script>
<?

//header('Refresh: 20');
$username="*****";
$password="**********************";
$database="***********************";
$localhost="************************";

$editor = "
<option value='phil'>Phil Hopper</option>
<option value='robyn'>Robyn Adamson</option>
<option value='patrick'>Patrick O'Kane</option>
<option value='andrew.robinson'>Andrew Robinson</option>
<option value='Other'>Other</option>
";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>

</head>

<body>

<form id="form1" name="form1" method="post" action="insert_project.php">

<table width="200" border="1">
<tr>
    <td>Project Name</td>
    <td>
            <input type='text' name='project_name' value='' />
    
              </tr>
  <tr>
    <td>Client Name</td>
    	<td>	<input type='text' name='client_name'input value=''>
       
        
    </td>
     </tr>
    <tr>
    <td>Client Contact Number</td>
    	<td>	<input type='text' name='client_tel'input value=''>
       
        
    </td>
     </tr>
     <tr>
    <td>Client Email</td>
    	<td>	<input type='text' name='client_email'input value=''>   
    </td>
     </tr>
      <tr>
    <td>Short Project Description</td>
    <td><textarea name="description" cols="17" rows="5"></textarea></td>
          </tr>
     <tr>
    <td>Logos</td>
    <td>
    <input type='text' name='logos'input value=''>
                        
              </tr>
  <tr>
    <td>Deadline</td>
      
  	<td>	 <div data-role="fieldcontain">
            <input type="date" name="deadline" id="deadline" value="date" />
       </div> 
       
        
    </td>
 </tr>
  <tr>
    <td>BNL Deadline</td>
      
  	<td>	 <div data-role="fieldcontain">
            <input type="date" name="bnl" id="bnl" value="date" />
       </div> 
       
        
    </td>
 </tr>
 <tr>
    <td>Project Manager</td>
    <td>
    <input type='text' name='manager'input value=''>
                        
              </tr>
  <tr>
    <td>Filming</td>
    <td>
    <input type='text' name='filiming'input value=''>
                        
              </tr>
  <tr>
    <td>Editor</td>
    <td>
     <select name="editor" id="editor">
           <option value=""></option>
          <? echo "$editor"?>
        </select>             
              </tr>
   <tr>
    <td>Dropbox Folder</td>
    <td>
    <input type='text' name='dropboxfolder'input value=''>
                        
              </tr>
   <tr>
    <td>Music Theme</td>
    <td>
    <input type='text' name='music'input value=''>
                        
              </tr>
   <tr>
    <td>Songs per project</td>
    <td>
    <input type='text' name='songs'input value=''>
                        
              </tr>
              
   <tr>
    <td>Clients expected time</td>
    <td>
    <input type='text' name='client_time'input value=''>
                        
              </tr>
              <tr>
    <td>Expected Outcome</td>
    <td>
    <input type='text' name='outcome'input value=''>
                        
              </tr>
                <tr>
    <td>Notes</td>
    <td><textarea name="notes" cols="17" rows="5"></textarea></td>
          </tr>
</table>
<? mysql_close();?>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</form>

</body>
</html>

This is the action code:
PHP:
<?
$project_name = $_POST['project_name']; 
$client_name = $_POST['client_name'];
$client_tel = $_POST['client_tel'];
$client_email = $_POST['client_email'];
$description = $_POST['description'];
$logos = $_POST['logos'];
$deadline = $_POST['deadline'];
$bnl = $_POST['bnl'];
$manager = $_POST['manager'];
$filiming = $_POST['filiming'];
$editor = $_POST['editor'];
$dropboxfolder = $_POST['dropboxfolder'];
$music = $_POST['music'];
$songs = $_POST['songs'];
$client_time = $_POST['client_time'];
$outcome = $_POST['outcome'];
$notes = $_POST['notes'];

error_reporting(E_ALL);
ini_set('display_errors', ‘1’);


//header('Refresh: 20');
$username="*";
$password="*";
$database="*";
$localhost="*";

mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier = NULL ] );

$query_insert = "INSERT INTO projects VALUES ('$project_name','$client_name','$client_tel','$client_email','$description','$logos','$deadline','$bnl','$manager','$filiming','$dropboxfolder','$editor','$music','$songs','$client_time','$outcome','$notes')";
mysql_query($query_insert);  

$to = "[email protected]";
$subject = "$project_name";

$message ="$manager has filled in the Project form.\n 
Project Name:		$project_name\n 
Client Name: 		$client_name\n
Client telephone:   $client_tel\n
Client Email:       $client_email\n
Description:		$description\n 
Logos: 		        $logos\n
Client deadline:    $deadline\n
BNL deadline:       $bnl\n
Project Manager:	$manager\n 
Filming: 		    $filiming\n
Dropbox Folder: 		    $dropboxfolder\n
Music:              $music\n
N0. Songs:		    $songs\n 
Logos: 		        $client_time\n
Expected Outcome:   $outcome\n
Notes:              $notes\n
 ";

$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);


mysql_close();

header( 'Location: index.php' ) ;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>

</body>
</html>
 
Are you getting any error messages (on page and the log file)?
What's the output of the query if you print/echo it?
Have you tested this query manually on the MySQL server (via PHPMyAdmin etc)? If not, test it and see if an errors are reported?

I would however looking at moving to MySQLi or PDO for database interaction within PHP and similarly you really want to look at sterilising the form data prior to inserting it into the database.

Am curious to what the escape_string is doing though? :confused:
 
Back
Top Bottom