Jump to content

Archived

This topic is now archived and is closed to further replies.

Jeannie109

Job List Completed Job/Post to Web Page

Recommended Posts

[img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /] I have a Job List with different fields. I would like a column that would have the ability to click on C(ompleted) and when you check it off it will post these jobs to a new web page of completed jobs. Actually, instead of having the Delete choice, I would like a C(ompleted) choice with the V(iew) and E(dit) I can't figure out how to do this. Any help would be appreciated. Here is the site:
[a href=\"http://jobboard.bernardtransportation.com/jobs.php?posting=yes&\" target=\"_blank\"]http://jobboard.bernardtransportation.com/...hp?posting=yes&[/a]
Please don't delete any entries or make any radical changes to the Job List.

Share this post


Link to post
Share on other sites
Do you have any of the code behind what's allready there?

Share this post


Link to post
Share on other sites
[!--quoteo(post=379935:date=Jun 4 2006, 08:21 AM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ Jun 4 2006, 08:21 AM) [snapback]379935[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Do you have any of the code behind what's allready there?
[/quote]
All the code is on the one page:

[code]<?php
echo "<LINK rel='stylesheet' type='text/css' href='style.css' >";
/*------------------------------------------------
THE FOLLOWING ALLOWS GLOBALS = OFF SUPPORT
------------------------------------------------*/
// $_GET VARIABLES
foreach($_GET as $a=>$b){$$a=$b;}

// $_POST VARIABLES
foreach($_POST as $a=>$b){$$a=$b;}
/*------------------------------------------------
END GLOBALS OFF SUPPORT
------------------------------------------------*/

echo "<Font Face='verdana' size='2'>";

/*---------------------------------------------------------------------------------
TURN DEBUG ON - THIS ALLOWS YOU TO VIEW ALL SQL STATEMENTS AS THEY ARE EXECUTED
$sql_debug_mode=0 --> OFF (NO SQL STATEMENTS WILL BE SHOWN)
$sql_debug_mode=1 --> ON (SQL STATEMENTS WILL BE SHOWN)
---------------------------------------------------------------------------------*/
$sql_debug_mode=0;


/*---------------------------------------------------------------------------------
ERROR REPORTING: TO VIEW ALL ERRORS SET error_reporting TO E_ALL
OTHER ERROR REPORTING OPTIONS (FROM THE PHP.INI FILE):
; error_reporting is a bit-field. Or each number up to get desired error
; reporting level
; E_ALL - All errors and warnings
; E_ERROR - fatal run-time errors
; E_WARNING - run-time warnings (non-fatal errors)
; E_PARSE - compile-time parse errors
; E_NOTICE - run-time notices (these are warnings which often result
; from a bug in your code, but it's possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it's automatically initialized to an
; empty string)
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
; initial startup
; E_COMPILE_ERROR - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated notice message
;
; Examples:
;
; - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE
;
; - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
;
; - Show all errors except for notices
;
error_reporting = E_PARSE|E_ERROR|E_WARNING|E_NOTICE; display all errors, warnings and notices
---------------------------------------------------------------------------------*/
error_reporting(E_WARNING|E_PARSE);

//SET THESE VARIABLES TO CUSTOMIZE YOUR PAGE
$thispage = $SCRIPT_NAME; //SET THIS TO THE NAME OF THIS FILE
$pagevars = ""; //INSERT ANY "GET" VARIABLES HERE...



/*----------------------------------------------------------------------
NOTE: THE FOLLOWING 4 "allow" VARIABLES SIMPLY DISABLE THE LINKS FOR
ADD/EDIT/VIEW/DELETE.
----------------------------------------------------------------------*/
$allowedit = "yes"; //SET TO "no" IF YOU WANT TO DISABLE EDITING
$allowaddnew = "yes"; // SET TO "no" IF YOU WANT TO DISABLE NEW RECORDS
$allowview = "yes"; //SET TO "no" IF YOU WANT TO DISABLE VIEWING RECORDS
$allowdelete = "yes"; //SET TO "no" IF YOU WANT TO DISABLE DELETING RECORDS


/*----------------------------------------------------------------------
* SEARCH SECTIONS BY CODE-NUMBER (LISTED BELOW). (7/7/02):
THIS CAN BE VERY USEFUL WHEN IDENTIFYING SECTIONS YOU WISH TO EDIT.

USE THE FOLLOWING CODES IN YOUR SEARCH (TYPICALLY, USE CTRL + F):
9991 - SEARCH SECTION (INCLUDES SEARCH FORM AND SEARCH RESULTS)
|_ 9991SQL - SQL STATEMENT FOR SEARCH RESULTS
|_ 9991FORM - FORM USED FOR POSTING SEARCHES
9992 - VIEW RECORD SECTION (VIEWING SINGLE-RECORD)
|_ 9992SQL - SQL STATEMENT FOR OBTAINING SINGLE-RECORD
9993 - EDIT RECORD SECTION (FORM USED FOR EDITING AND POST RESULTS)
|_ 9993SQLGET - SQL STATEMENT USED FOR OBTAINING EDIT RECORD
|_ 9993SQLUPD - SQL STATEMENT USED FOR UPDATING POSTED RECORD
|_ 9993SQLFORM - USER INPUT FORM FOR EDITING RECORD
9994 - ADD RECORD SECTION
|_ 9994SQL - SQL STATEMENT USED TO INSERT A RECORD
|_ 9994FORM - FORM USED TO CREATE NEW RECORDS
9995 - DELETE RECORD SECTION
|_ 9995SQL - SQL STATEMENT USED TO DELETE A RECORD
|_ 9995CONFIRM = CONFIRMATION TO DELETE RECORD


* GLOBALLY APPEND CRITERIA TO YOUR SQL STATEMENTS USING THE
$addl_select AND $addl_insert VARIABLES BELOW. (7/7/02):
USEFUL FOR SPECIFYING USERNAMES, OR OTHER RECORD-LIMITING CRITERIA.
* THE $addl_select_crit WILL BE APPENDED TO ALL SEL/UPD/DEL
STATEMENTS, AS "WHERE" CRITERIA, BEFORE ANY ORDER/LIMIT
STATEMENTS ARE APPLIED.
EXAMPLE: $addl_select_crit (NOTE! YOU MUST INCLUDE 'AND')
$addl_select_crit = "AND (userid='$someusersid'
AND create_date='2002-07-07')";

* THE $addl_insert_crit AND $addl_insert_values VARIABLES
WILL BE APPENDED TO ALL INSERT STATEMENTS.

EXAMPLE: $addl_insert_crit (NOTE! YOU MUST INCLUDE A COMMA (,)
BETWEEN FIELDS AND VALUES)
$addl_insert_crit = ",userid, create_date";
EXAMPLE: $addl_insert_values (NOTE! YOU MUST INCLUDE A COMMA (,))
BETWEEN FIELDS AND VALUES)
$addl_insert_values = ",'$someusersid','2002-07-07'";
EXAMPLE: $addl_select_crit (NOTE! YOU MUST ADD AND/OR)
$addl_select_crit = " AND userid = '$someuserid'"
EXAMPLE: $addl_update_crit (NOTE! YOU MUST INCLUDE A COMMA (,))
$addl_update_crit = "',userid='$someuserid'"
----------------------------------------------------------------------*/
$addl_select_crit = ""; //ADDL CRITERIA FOR SQL STATEMENTS (ADD/UPD/DEL).
$addl_update_crit = ""; //ADDITIONAL CRITERIA FOR UPDATE STATEMENTS.
$addl_insert_crit = ""; //ADDITIONAL CRITERIA FOR INSERT STATEMENTS.
$addl_insert_values = ""; //ADDITIONAL VALUES FOR INSERT STATEMENTS.

/*----------------------------------------------------------------------
NOTE: SOME SERVERS RUN "MAGIC QUOTES" TO FIX STRINGS WHEN INSERTING/
UPDATING RECORDS. IF MAGIC QUOTES OPTION IS DISABLED, THE GENERATED
CODE WILL AUTOMATICALLY FIX STRINGS TO HELP ELIMINATE ERRORS.
----------------------------------------------------------------------*/
if (get_magic_quotes_gpc()) { $addslash="no"; } //AUTO-ADD SLASHES IF MAGIC QUOTES IS OFF


/*----------------------------------------------------------------------
FUNCTIONS
----------------------------------------------------------------------*/


/*---------------------------------------------------------------
FUNCTION: db()
DESCRIPTION: CREATES DB CONNECTION OBJECT FOR KNEBEL.NET
PHP CODE GENERATOR CODE.
INPUTS: NONE
RETURNS: DATABASE CONNECTION OBJECT
GLOBAL VARIABLES: NONE
FUNCTIONS CALLED: NONE
CALLED BY:
AUTHOR: KNEBEL
MODIFICATIONS:
MM/DD/YY - CREATED FUNCTION (KNEBEL.NET)
NOTES:

----------------------------------------------------------------*/
function db()
{
$dbuser = "************";
$dbserver = "*************";
$dbpass = "*************";
$dbname = "***************";

//CONNECTION STRING
$db_conn = mysql_connect($dbserver, $dbuser, $dbpass)
or die ("UNABLE TO CONNECT TO DATABASE");
mysql_select_db($dbname)
or die ("UNABLE TO SELECT DATABASE");
return $db_conn;
}//end function db


function FixString($strtofix)
{ //THIS FUNCTION ESCAPES SPECIAL CHARACTERS FOR INSERTING INTO SQL
if (get_magic_quotes_gpc()) { $addslash="no"; } else { $addslash="yes"; }
if ($addslash == "yes") { $strtofix = addslashes($strtofix); }
$strtofix = ereg_replace( "<", "<", $strtofix );
$strtofix = ereg_replace( "'", "'", $strtofix );
$strtofix = ereg_replace( "(\n)", "<BR>", $strtofix );
return $strtofix;
}//end FixString

function ThrowError($err_type,$err_descr)
{ //THIS FUNCTION PROVIDES ERROR DESCRIPTIONS
$err_text = "";
switch ($err_type)
{
case "9991SQLresultcount":
return "<BR><B>ERROR: --> " . mysql_error() ."</b>
<BR>LOCATION: $err_type
<BR>DESCRIPTION: Unable to execute SQL statement.
<BR>Please Check the Following:
<BR>- Ensure the Table(s) Exists in database $dbname
<BR>- Ensure All Fields Exist in the Table(s)

<BR>- SQL STATEMENT: $err_descr<BR>
<BR>- MYSQL ERROR: " . mysql_error();
break;
case "9994SQL":
return "<BR><B>ERROR: --> " . mysql_error() ."</b>
<BR>LOCATION: $err_type
<BR>DESCRIPTION: Unable to execute SQL statement.
<BR>Please Check the Following:
<BR>- Ensure the Table(s) Exists in database $dbname
<BR>- Ensure All Fields Exist in the Table(s)

<BR>- SQL STATEMENT: $err_descr<BR>
<BR>- MYSQL ERROR: " . mysql_error();
break;
default:
return "UNKNOWN ERROR TYPE: $err_type
<BR>DESCR: $err_descr<BR>";
break;
} //end switch

return $err_text;
} //end ThrowError
/*----------------------------------------------------------------------
END FUNCTIONS
----------------------------------------------------------------------*/


/*----------------------------------------
ADD NEW LINK
----------------------------------------*/
if ($proc == "") {
if ($allowaddnew == "yes") {
?>
<table border=0 width=30% align=center>
<tr>
<td align=center><br><br><font size="3"><b>BTG Job Board</b></font><br><br>
<table border=0 align=center width=800>
<tr>
<td align=center>| <a href=jobs.php?posting=yes&>Job List</a> |
<a href=jobs.php?proc=New&>Add a Job</a> |
<a href=jobs.php?proc=&>Search</a> |
</td></tr></table><br>
<? }


/*---------------------------------------------------------------------------------------
BEGIN SEARCH SECTION 9991
---------------------------------------------------------------------------------------*/
/*-- SECTION: 9991FORM --*/
?>
<form method="POST" action="<?php echo $thispage; ?>?posting=yes&<?php echo $pagevars; ?>">
<p><B>Search:</B> <input type="text" CLASS='TXT_BOX' name="searchcrit" size="20" value="<? echo $searchcrit; ?>">
<INPUT CLASS="BUTTON" TYPE="SUBMIT" VALUE="Search!" NAME="B1"></P>
</form>
</td>
</tr>
</table>
<?

/*----------------------------------------------------------------
IF THEY ARE POSTING TO THE SEARCH PAGE
(SHOW SEARCH RESULTS)
----------------------------------------------------------------*/
if ($posting == "yes") {


/*----------------------------------------------------------------
PAGING SETTINGS - THIS IS USED FOR NEXT/PREVIOUS X RECORDS
----------------------------------------------------------------*/
$pagenorecords = 20; //THIS IS THE PAGE SIZE
//IF NO PAGE
if ($page == 0) {
$myrecstart = 0;
} else {
$myrecstart = ($page * $pagenorecords);
}


/*-- SECTION: 9991SQL --*/
if ($searchcrit == "") {
$flag = "all";
$sql = "SELECT * FROM loads";
$sqlcount = "select count(*) as reccount from loads";
} else {
//IF THEY TYPED SEARCH WORDS
$sqlcount = "select count(*) as reccount from loads WHERE (";
$sql = "SELECT * FROM loads WHERE (";
$sqlwhere = "

mnum like '%$searchcrit%' OR
loadnum like '%$searchcrit%' OR
ddate like '%$searchcrit%' OR
carrier like '%$searchcrit%' OR
pickup like '%$searchcrit%' OR
destination like '%$searchcrit%' OR
dtime like '%$searchcrit%' OR
notes like '%$searchcrit%'

"; //FINISH SQL STRING

//NOTE:CHECK ABOVE FOR AN EXTRA "OR":
//IF YOU LEFT THE LAST
//FIELD IN THE FIELD NAME ENTRY FORM BLANK, YOU WILL
//GET AN EXTRA "OR" ABOVE. SIMPLY DELETE IT.

} //END IF SEARCHCRIT = "";

if ($flag == "all") {
$sql = $sql . " WHERE (1=1) $addl_select_crit LIMIT $myrecstart, $pagenorecords";
$sqlcount = $sqlcount . " WHERE (1=1) $addl_select_crit LIMIT $myrecstart, $pagenorecords";
} else {
$sqlcount = $sqlcount . $sqlwhere . ") $addl_select_crit LIMIT $myrecstart, $pagenorecords";
$sql = $sql . $sqlwhere . ") $addl_select_crit LIMIT $myrecstart, $pagenorecords";

}

if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }



//SET PAGE
if ($page == 0) {
$page = 1;
} else {
$page = ($page + 1);
}

/*----------------------------------------------------------------
FIND OUT HOW MANY RECORDS WE HAVE
----------------------------------------------------------------*/

if ($reccount == 0)
{
//$resultcount = (mysql_query($sqlcount,db() )) OR DIE (ThrowError($err_type,$err_descr););
$resultcount = (mysql_query($sqlcount,db() )) OR DIE (ThrowError("9991SQLresultcount",$sqlcount));
if ($myrowcount = mysql_fetch_array($resultcount))
{
$reccount = $myrowcount["reccount"];
} //IF RECCOUNT = 0
}//end if reccount

echo "<table border=0 width=95% align=center><tr><td>
<DIV CLASS='NUM_RECS_FOUND'>$reccount Records Found</DIV>";
echo "<DIV CLASS='CURR_PAGE'>Page $page</DIV></td></tr></table>";


/*----------------------------------------------------------------
PAGING LINK - THIS IS USED FOR NEXT/PREVIOUS X RECORDS
----------------------------------------------------------------*/
if ($reccount > 20) {
$ttlpages = ($reccount / 20);
if ($page < $ttlpages) {
?>

<HR> <br>
<A HREF="<?php echo $thispage; ?>?posting=yes&page=<?php echo $page; ?>&reccount=<?php echo $reccount; ?>&searchcrit=<?php echo $searchcrit; ?>&<?php echo $pagevars; ?>">Next <?php echo $pagenorecords; ?> Records >></a><br>
<?php
} //END IF AT LAST PAGE
} //END IF RECCOUNT > 20

if ($page > 0) {
$newpage = $page - 2;
}
if ($newpage != -1) {
?>
<br>
<A HREF="<?php echo $thispage; ?>?posting=yes&page=<?php echo $newpage; ?>&reccount=<?php echo $reccount; ?>&searchcrit=<?php echo $searchcrit; ?>&<?php echo $pagevars; ?>"><< Previous <?php echo $pagenorecords; ?> Records</a>
<br>
<?php

} //IF NEWPAGE != -1
/*----------------------------------------------------------------
END PAGING LINK - THIS IS USED FOR NEXT/PREVIOUS X RECORDS
----------------------------------------------------------------*/
//EXECUTE OUR SQL STRING FOR THE TABLE RECORDS
$result = mysql_query($sql,db() );
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
if ($myrowsel = mysql_fetch_array($result)) {
$id = $myrowsel["id"];

echo " <font size=-2>V=View E=Edit D=Delete</font><br><TABLE class=sortable id=job_id bgcolor=FFFFC0 border=1 width=95% align=center>";
echo " <TR>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>OPTIONS</DIV></TH>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>MNUM</DIV></TH>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>LOAD#</DIV></TH>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>DDATE</DIV></TH>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>CARRIER</DIV></TH>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>PICKUP</DIV></TD>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>DESTINATION</DIV></TH>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>DTIME</DIV></TH>";
echo " <TH align=center><DIV CLASS='TBL_COL_HDR'>NOTES</DIV></TH>"; echo "\n\n </TR>";
do
{
//FORMAT THE OUTPUT OF THE SEARCH
$id = $myrowsel["id"];

//SWITCH ROW COLORS
switch ($shade)
{
case "TBL_ROW_DATA_LIGHT":
$shade = "TBL_ROW_DATA_DRK";
break;
case "TBL_ROW_DATA_DRK":
$shade = "TBL_ROW_DATA_LIGHT";
break;
default:
$shade = "TBL_ROW_DATA_DRK";
break;
}//end switch shade

/*----------------------------------------------------------------
VIEW SEARCH RESULTS BY PAGE
----------------------------------------------------------------*/

/*---------------------------------------
BEGIN RESULTS TABLE
---------------------------------------*/

echo "<TR>";
?>
<TD CLASS='<?php echo $shade; ?>'>
<DIV CLASS='PAGE_OPTIONS'>
<?php if ($allowview == "yes") { ?><a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=View&<?php echo $pagevars; ?>">V </a>
<?php } ?><?php if ($allowedit == "yes") { ?>
<a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=Edit&<?php echo $pagevars; ?>">E </a>
<?php } ?><?php if ($allowdelete == "yes") { ?>
<a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=Delete&<?php echo $pagevars; ?>">D</a>
<?php } ?>
</DIV>
</TD>
<?php $mnum = $myrowsel["mnum"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $mnum; ?>
</TD>
<?php $loadnum = $myrowsel["loadnum"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $loadnum; ?>
</TD>
<?php $ddate = $myrowsel["ddate"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $ddate; ?>
</TD>
<?php $carrier = $myrowsel["carrier"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $carrier; ?>
</TD>
<?php $pickup = $myrowsel["pickup"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $pickup; ?>
</TD>
<?php $destination = $myrowsel["destination"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $destination; ?>
</TD>
<?php $dtime = $myrowsel["dtime"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $dtime; ?>
</TD>
<?php $notes = $myrowsel["notes"]; ?>
<TD CLASS='<?php echo $shade; ?>'>
<?php echo $notes; ?>
</TD>
</TR>
<?
} while ($myrowsel = mysql_fetch_array($result));
echo "</TABLE>";
/*----------------------------------------------------------------
PAGING LINK - THIS IS USED FOR NEXT/PREVIOUS X RECORDS
----------------------------------------------------------------*/
if ($reccount > 20) {
//IF THERE ARE MORE THAN 20 RECORDS PAGING
$ttlpages = ($reccount / 20);
if ($page < $ttlpages) {
?>

<HR> <br>
<A HREF="<?php echo $thispage; ?>?posting=yes&page=<?php echo $page; ?>&reccount=<?php echo $reccount; ?>&searchcrit=<?php echo $searchcrit; ?>&<?php echo $pagevars; ?>">Next <?php echo $pagenorecords; ?> Records >></a> <br>

<?php
} //END IF AT LAST PAGE
} //END IF RECCOUNT > 20
//PREVIOUS RECORDS LINK
if ($page > 0) {
$newpage = $page - 2;
}
if ($newpage != -1) {
?>

<br>
<A HREF="<?php echo $thispage; ?>?posting=yes&page=<?php echo $newpage; ?>&reccount=<?php echo $reccount; ?>&searchcrit=<?php echo $searchcrit; ?>&<?php echo $pagevars; ?>"><< Previous <?php echo $pagenorecords; ?> Records</a>
<br>
<?php
} //IF NEWPAGE != -1
/*----------------------------------------------------------------
END PAGING LINK - THIS IS USED FOR NEXT/PREVIOUS X RECORDS
----------------------------------------------------------------*/
} //END PROC == ""
} //END IF POSTING = YES
/*---------------------------------------------------------------------------------
END SEARCH SECTION 9991
---------------------------------------------------------------------------------*/

}// END IF PROC = ""

?>
<?

/*----------------------------------------------------------------------
ADD NEW RECORDS SECTION
----------------------------------------------------------------------*/
if ($proc == "New") {
?>
<table border=0 align=center width=90%><tr><td align=center><br><br><font size="3"><b>BTG Job Board</b></font><br><br>
<table border=0 align=center width=800>
<tr>
<td align=center>| <a href=jobs.php?posting=yes&>Job List</a> |
<a href=jobs.php?proc=New&>Add a Job</a> |
<a href=jobs.php?proc=&>Search</a> |
</td></tr></table><br><br>
<TABLE border=1 width=40% align=center><tr><td>
<?
if ($allowaddnew == "yes") {
?>

<? } //END OF IF ALLOW ADDNEW
/*-------------------------------------------------------------------------------
ADD NEW RECORD SECTION 9994
-------------------------------------------------------------------------------*/

if ($proc == "New") {
echo "<DIV CLASS='PAGE_STATUS'>Adding Record</DIV>";
if ($post == "yes") {
/*
WE ARE ADDING A NEW RECORD SUBMITTED FROM THE FORM
NOW LOOP THROUGH ALL OF THE RECORDS AND OUTPUT A STRING
*/

/* FIX STRING */
$mnum = FixString($mnum);
$loadnum = FixString($loadnum);
$ddate = FixString($ddate);
$carrier = FixString($carrier);
$pickup = FixString($pickup);
$destination = FixString($destination);
$dtime = FixString($dtime);
$notes = FixString($notes);



/*-- SECTION: 9994SQL --*/
$sql = "INSERT INTO loads (
mnum,
loadnum,
ddate,
carrier,
pickup,
destination,
dtime,
notes
$addl_insert_crit ) VALUES ( '$mnum',
'$loadnum',
'$ddate',
'$carrier',
'$pickup',
'$destination',
'$dtime',
'$notes'
$addl_insert_values )";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql,db() );
if ($result == 1) {
echo "<DIV CLASS='SQL_RESULTS'>Record Inserted</DIV>";
} else {
echo ThrowError("9994SQL",$sql);
echo "Error inserting record (9994SQL)";
}
//***** END INSERT SQL *****
} //END IF POST = YES FOR ADDING NEW RECORDS
/*-------------------------------------------------------------------------------
ADD NEW RECORD (CREATING)
-------------------------------------------------------------------------------*/
if (!$post) {//THEN WE ARE ENTERING A NEW RECORD
//SHOW THE ADD RECORD RECORD DATA INPUT FORM
/*-- SECTION: 9994FORM --*/
?>
<FORM METHOD="POST" ACTION="<?php echo $thispage; ?>?proc=New&post=yes&<?php echo $pagevars; ?>">
<TABLE border=1 width=80% align=center>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>MNUM:</B>
</TD>
<TD>
<INPUT CLASS='TXT_BOX' type="text" NAME="mnum" SIZE="30">
</TR>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>LOADNUM:</B>
</TD>
<TD>
<INPUT CLASS='TXT_BOX' type="text" NAME="loadnum" SIZE="30">
</TR>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>DDATE:</B>
</TD>
<TD>
<INPUT CLASS='TXT_BOX' type="text" NAME="ddate" SIZE="30">
</TR>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>CARRIER:</B>
</TD>
<TD>
<INPUT CLASS='TXT_BOX' type="text" NAME="carrier" SIZE="30">
</TR>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>PICKUP:</B>
</TD>
<TD>
<INPUT CLASS='TXT_BOX' type="text" NAME="pickup" SIZE="30">
</TR>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>DESTINATION:</B>
</TD>
<TD>
<INPUT CLASS='TXT_BOX' type="text" NAME="destination" SIZE="30">
</TR>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>DTIME:</B>
</TD>
<TD>
<INPUT CLASS='TXT_BOX' type="text" NAME="dtime" SIZE="30">
</TR>
<TR>
<TD CLASS='TBL_ROW_HDR'>
<B>NOTES:</B>
</TD>
<TD>
<textarea CLASS='TXT_BOX'NAME="notes" ROWS="4" cols="35"></TEXTAREA>
</TR>
<TR>
<TD>
</TD>
<TD>
<INPUT CLASS='BUTTON' TYPE="SUBMIT" VALUE="SAVE" NAME="SUBMIT">
<INPUT CLASS='BUTTON' TYPE="RESET" VALUE="RESET" NAME="RESET">
</TD>
</TR>
</TABLE>
<BR>
</FORM>
</td></tr></table>
<?php
} //END if post=""
//***** END ADD NEW ENTRY FORM*****
} //END PROC == NEW


/*---------------------------------------------------------------------------------
END ADD SECTION 9994
---------------------------------------------------------------------------------*/}// END IF PROC = "NEW"
?>
<?
/*-------------------------------------------------
SEARCH AND ADD-NEW LINKS
-------------------------------------------------*/
if ($proc == "Edit") {
?>
<table border=0 align=center width=90%><tr><td align=center><br><br><font size="3"><b>BTG Job Board</b></font><br><br>
<table border=0 align=center width=800>
<tr>
<td align=center>| <a href=jobs.php?posting=yes&>Job List</a> |
<a href=jobs.php?proc=New&>Add a Job</a> |
<a href=jobs.php?proc=&>Search</a> |
</td></tr></table><br><br>

<?
if ($allowaddnew == "yes") {
?>

<? } //END OF IF ALLOW ADDNEW

/*----------------------------------------------------------------------
EDIT RECORDS SECTION
----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------
EDIT RECORD SECTION 9993
-------------------------------------------------------------------------------*/


if ($proc == "Edit") {
//SHOW THE EDIT RECORD RECORD PAGE
//******************************************************************//
if ($post == "yes") {
//THEN WE ARE POSTING UPDATES TO A RECORD
//***** BEGIN UPDATE SQL*****

//REPLACE THE FIELD CONTENTS SO THEY DON'T MESS UP YOUR QUERY
//NOW LOOP THROUGH ALL OF THE RECORDS AND OUTPUT A STRING

/* FIX STRING */
$mnum = FixString($mnum);
$loadnum = FixString($loadnum);
$ddate = FixString($ddate);
$carrier = FixString($carrier);
$pickup = FixString($pickup);
$destination = FixString($destination);
$dtime = FixString($dtime);
$notes = FixString($notes);

//SQL STRING
/*-- SECTION: 9993SQLUPD --*/



$sql = "UPDATE loads SET
mnum='$mnum',
loadnum='$loadnum',
ddate='$ddate',
carrier='$carrier',
pickup='$pickup',
destination='$destination',
dtime='$dtime',
notes='$notes'
$addl_update_crit
WHERE (id='$id') $addl_select_crit ";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql,db() );
if ($result == 1) {
echo "<DIV CLASS='SQL_RESULTS'>Updated</DIV>";
} else {
echo "Error Updating Record (9993SQLUPD)";
}
//***** END UPDATE SQL *****
} //END IF POST IS YES

/*-------------------------------------------------------------------------------
EDIT RECORD (FORM) - SHOW THE EDIT RECORD RECORD DATA INPUT FORM
-------------------------------------------------------------------------------*/
if ($post == "") { //THEN WE ARE EDITING A RECORD
echo "<table border=1 width=400 align=center><tr><td><DIV CLASS='PAGE_STATUS'>Editing Record</DIV>";

?>
<TABLE width=450 align=center><tr><td><DIV CLASS='PAGE_OPTIONS'>
<?php if ($allowview == "yes") { ?><a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=View&<?php echo $pagevars; ?>">V</a>
<?php } //END ALLOWVIEW ?><?php if ($allowedit == "yes") { ?>
<a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=Edit&<?php echo $pagevars; ?>">E</a>
<?php } //END ALLOWEDIT ?><?php if ($allowdelete == "yes") { ?>
<a href="<?php echo $thispage; ?>?id=<?php echo $id; ?>&proc=Delete&<?php echo $pagevars; ?>">D</a>
<?php } //END ALLOWDELETE ?></font><font face="arial" size="2">
</DIV></td>
</tr>
</table>
<?

/*-- SECTION: 9993SQLGET --*/
$sql = "SELECT * FROM loads WHERE (id = '$id') $addl_select_crit ";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql,db() ) or die ("Error Retrieving Records (9993SQLGET)");
if ($myrow = mysql_fetch_array($result)) {
do
{

$mnum = $myrow["mnum"];
$mnum = ereg_replace("(\n)", "<BR>", $mnum);
$loadnum = $myrow["loadnum"];
$loadnum = ereg_replace("(\n)", "<BR>", $loadnum);
$ddate = $myrow["ddate"];
$ddate = ereg_replace("(\n)", "<BR>", $ddate);
$carrier = $myrow["carrier"];
$carrier = ereg_replace("(\n)", "<BR>", $carrier);
$pickup = $myrow["pickup"];
$pickup = ereg_replace("(\n)", "<BR>", $pickup);
$destination = $myrow["destination"];
$destination = ereg_replace("(\n)", "<BR>", $destination);
$dtime = $myrow["dtime"];
$dtime = ereg_replace("(\n)", "<BR>", $dtime);
$notes = $myrow["notes"];
$notes = ereg_replace("(\n)", "<BR>", $notes);
?>

<form method="post" action="<?php echo $thispage; ?>?proc=Edit&post=yes&<?php echo $pagevars; ?>">
<TABLE border=1 width=90% align=center>
<TR>
<TD CLASS='TBL_ROW_HDR'>
MNUM:
</TD>
<TD>
<INPUT TYPE='TEXT' CLASS='TXT_BOX' name='mnum' value='<?php echo$mnum; ?>' size='30'>
</td>
</tr>
<TR>
<TD CLASS='TBL_ROW_HDR'>
LOADNUM:
</TD>
<TD>
<INPUT TYPE='TEXT' CLASS='TXT_BOX' name='loadnum' value='<?php echo$loadnum; ?>' size='30'>
</td>
</tr>
<TR>
<TD CLASS='TBL_ROW_HDR'>
DDATE:
</TD>
<TD>
<INPUT TYPE='TEXT' CLASS='TXT_BOX' name='ddate' value='<?php echo$ddate; ?>' size='30'>
</td>
</tr>
<TR>
<TD CLASS='TBL_ROW_HDR'>
CARRIER:
</TD>
<TD>
<INPUT TYPE='TEXT' CLASS='TXT_BOX' name='carrier' value='<?php echo$carrier; ?>' size='30'>
</td>
</tr>
<TR>
<TD CLASS='TBL_ROW_HDR'>
PICKUP:
</TD>
<TD>
<INPUT TYPE='TEXT' CLASS='TXT_BOX' name='pickup' value='<?php echo$pickup; ?>' size='30'>
</td>
</tr>
<TR>
<TD CLASS='TBL_ROW_HDR'>
DESTINATION:
</TD>
<TD>
<INPUT TYPE='TEXT' CLASS='TXT_BOX' name='destination' value='<?php echo$destination; ?>' size='30'>
</td>
</tr>
<TR>
<TD CLASS='TBL_ROW_HDR'>
DTIME:
</TD>
<TD>
<INPUT TYPE='TEXT' CLASS='TXT_BOX' name='dtime' value='<?php echo$dtime; ?>' size='30'>
</td>
</tr>
<TR>
<TD CLASS='TBL_ROW_HDR'>
NOTES:
</TD>
<TD>
<?php $notes=ereg_replace( "(<BR>)", "", $notes ); ?>
<textarea CLASS='TXT_BOX' name="notes" rows="4" cols="35"><?php echo$notes; ?></textarea>
</td>
</tr>
</td>
</tr&#

Share this post


Link to post
Share on other sites
What exactly do you want to the Complete to do? Make ti so it can not be edited anymore??

Share this post


Link to post
Share on other sites
I edited your code to remove the database access details that were visible.

In future, [b]please[/b] use the CODE buttons around your code so that it's readable.

If this is a third party script, it belongs in the freelancing forum. Tell me you wrote it and I'll leave it here, otherwise it gets moved because those are the forum rules.

Share this post


Link to post
Share on other sites

×

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.