Jump to content

Fresh eyes please


andrew_biggart

Recommended Posts

Can anyone see any reason why the inputs in this form do not save any values entered into the database. Yet the selects and textareas do!

 

<!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>Job Sheet</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>

<body>
<?php

if(isset($_POST['submitform']))
{
    include('config-jobs.php');

    //Parse & Escape form values
$jobclient    = mysql_real_escape_string(trim($_POST['jobclient']));
$jobbriefedby = mysql_real_escape_string(trim($_POST['jobbriefedby']));
$jobmanager   = mysql_real_escape_string(trim($_POST['jobmanager']));
$jobdesc      = mysql_real_escape_string(trim($_POST['jobdesc']));
$jobdate      = mysql_real_escape_string(trim($_POST['jobdate']));
$joblocation  = mysql_real_escape_string(trim($_POST['joblocation']));
$jobbrief     = mysql_real_escape_string(trim($_POST['jobbrief']));
$jobassets    = mysql_real_escape_string(trim($_POST['jobassets']));

    //Create & Run insert query
    $query = "INSERT INTO jobnumbers (jobclient, jobbriefedby, jobmanager, jobdesc, jobdate, joblocation, jobbrief, jobassets) VALUES ('$jobclient', '$jobbriefedby', '$jobmanager', '$jobdesc', '$jobdate', '$joblocation', '$jobbrief', '$jobassets')";
    $result = mysql_query($query);

    if (!$result)
    {
        //Query failed, display error
        echo"Error: <br />\n" . mysql_error() . "<br />\nQuery:<br />\n{$query}\n";
    }
    else
    {
	//Display job id of inserted record.
	$id = mysql_insert_id();
	$jobid = str_pad($id, 6, '0', STR_PAD_LEFT);
	$jobnum = "{$jobclient}-{$jobid}";

	$query2 = "UPDATE jobnumbers SET jobnum = '$jobnum' WHERE jobid = '$id'";
	$result2 = mysql_query($query2);

	if(!result2)
	{
		//Query failed, display error
        	echo"Error 2: <br />\n" . mysql_error() . "<br />\nQuery:<br />\n{$query}\n";
	}else{		
		echo"A new job has been added to the system. The ref number is $jobnum.";
	}

    }
}
?>
<div id="job-sheet">
<div id="job-sheet-inner">
    	<h1 class="job-sheet-h1">Job Sheet</h1>
        <h2 class="job-sheet-h2">No work will be accepted without a completed job sheet</h2>
        <form action="#" method="post">
            <table cellpadding="0" cellspacing="0">
          		<tr>
                    <td class="job-sheet-td-left">Client:</td>
                    <td class="job-sheet-td-right">
                    	<select id="jobclient" name="jobclient" class="job-sheet-select">
					<?php 
						include('config-jobs.php');
						// Retrieve data from database 
						$sql=" SELECT * FROM clients ORDER BY client_name ASC ";
						$result=mysql_query($sql);

						// Start looping rows in mysql database.
						while($rows=mysql_fetch_array($result)){
					?>
                        <option value="<?php echo $rows['client_code']; ?>"><?php echo $rows['client_name']; ?></option>
                        <?php
						// close while loop 
						}
						// close connection 
						mysql_close();                               
					?>
                        </select>                    
                    </td>
                </tr>
                <tr>
                    <td class="job-sheet-td-left">Briefed By:</td>
                    <td class="job-sheet-td-right">
                    	<select id="jobbriefedby" name="jobbriefedby" class="job-sheet-select">
					<?php 
						include('config-clients.php');
						// Retrieve data from database 
						$sql=" SELECT staff_name FROM staff_list ORDER BY staff_name ASC ";
						$result=mysql_query($sql);

						// Start looping rows in mysql database.
						while($rows=mysql_fetch_array($result)){
					?>
                        <option><?php echo $rows['staff_name']; ?></option>
                        <?php
						// close while loop 
						}
						// close connection 
						mysql_close();                               
					?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="job-sheet-td-left">Account Manager:</td>
                    <td class="job-sheet-td-right">
                    	<select id="jobmanager" name="jobmanager" class="job-sheet-select">
					<?php 
						include('config-clients.php');
						// Retrieve data from database 
						$sql=" SELECT staff_name FROM staff_list ORDER BY staff_name ASC ";
						$result=mysql_query($sql);

						// Start looping rows in mysql database.
						while($rows=mysql_fetch_array($result)){
					?>
                        <option><?php echo $rows['staff_name']; ?></option>
                        <?php
						// close while loop 
						}
						// close connection 
						mysql_close();                               
					?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="job-sheet-td-left">Job Description:</td>
                    <td class="job-sheet-td-right"><input type="text" id="jobdesc" name"jobdesc" class="job-sheet-input" value="Test Description" /></td>
                </tr>
                <tr>
                    <td class="job-sheet-td-left">Date Required:</td>
                    <td class="job-sheet-td-right"><input type="text" id="jobdate" name"jobdate" class="job-sheet-input" value="Test Date" /></td>
                </tr>
                <tr>
                    <td class="job-sheet-td-left">Assets Located:</td>
                    <td class="job-sheet-td-right"><input type="text" id="joblocation" name"joblocation" class="job-sheet-input " value="digital/kisumu/images/spring-summer-images" /></td>
                </tr>
			<tr>
                	<td class="job-sheet-td-top" colspan="2">Brief:</td>
                </tr>
                <tr>
                	<td class="job-sheet-td-bot" colspan="2"><textarea id="jobbrief" name="jobbrief" class="job-sheet-text" >Include as much information as possible</textarea></td>
                </tr>
                <tr>
                	<td class="job-sheet-td-top" colspan="2">Assets Required:</td>
                </tr>
                <tr>
                	<td class="job-sheet-td-bot" colspan="2"><textarea id="jobassets" name="jobassets" class="job-sheet-text">Include details of any logos, fonts, images, colours etc.</textarea></td>
                </tr>
                <tr>
                	<td class="job-sheet-bot" colspan="2"><input type="submit" id="submitform" name="submitform" class="job-sheet-submit" value="Submit Job" /></td>
                </tr>
            </table>
        </form>
</div><!-- /job-sheet-inner -->
</div><!-- /job-sheet -->
</body>
</html>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.