Jump to content

passing variable form one file to another how?


jbrill

Recommended Posts

ok, im asking this again... sorry

I just need help passing the "id" variable to the 2nd piece of code

file1.php


<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form id="form1" name="form1" method="post" action="addguestbook.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF" class="MainBody1">
<tr>
<td colspan="3">
<?


$result = mysql_query("SELECT * FROM jobs WHERE id='".$_GET['idr']."'");  // this id gets put into quote_id in the guest book table, this is the i need to pass

while($row = mysql_fetch_array($result))
	{
echo "<input name=\"quote_id\" type=\"hidden\" id=\"quote_id\" size=\"4\" value=\"".$row['id']."\"/>";		

	}

?>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF" >
<tr>
<td width="5%">Actual Time</td>
<td width="9%">Category</td>
<td width="11%">subcategory</td>
<td width="6%">machine time</td>
<td width="5%">Setup time</td>
<td>Proceedure</td>
<td width="25%">Completed</td>

</tr>


<tr>
<td align="center" valign="top"><input name="actual_time" type="text" id="actual_time" size="3" /></td>
<td align="center" valign="top"><input name="cat" type="text" id="cat" size="10" /></td>
<td align="center" valign="top"><input name="subcat" type="text" id="subcat" size="10" /></td>
<td align="center" valign="top"><input name="machine_time" type="text" id="machine_time" size="3" /></td>
<td align="center" valign="top"><input name="setup" type="text" id="setup" size="3" /></td>
<td align="center" valign="top"><textarea name=notes rows="10" id="notes" cols="90"></textarea></td>
<td align="center" valign="top">
<select name="complete">
<option selected value='selectstatus'>Select Status</option>
<option selected value='incomplete'>Incomplete</option>
<option selected value='complete'>Complete</option>
</select>
</td>

</tr>
</table></td>
</tr>
<tr>

<td colspan="7" align="center"><input type="submit" name="Submit" value="Add A New Step" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

 

 

file2.php

<? include 'admin_header.php'; 
if($_SESSION['type'] == "admin")
{





$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);





//check if query successful 
if($result){
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"3; URL=admin_modprocess.php?idr=' '&table=jobs\">"; //where idr= is where i need to put the passed variable form file1.php

}

else {
echo "ERROR";
}
mysql_close();
}
include 'admin_footer.php';
?>

 

basically, all i need to do is post the 'id' variable from the jobs table ( first query in file1.php) into the url so that i can retrieve it in file2.php, after it puts the correct info into the database, to use the variable to redirect back to the file1.php?id=.......

Put it right above this code:

 

$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);

that didnt work, besides, shoudl i be using $_POST in file 1.php and retrieving that POST in file 2.php

 

I want to use the retrieved id like so:

 

echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"3; URL=admin_modprocess.php?idr=' RETRIEVED ID HERE'&table=jobs\">";

 

this will send to the correct page as long as the id is corect.

 

quote_id is for the "guestbook" table and "id" is for the jobs table so i dont know if that makes a difference

 

ALSO: when i submit the form in file1.php, in the url for file2.php its just www.myurl.com/file.php there is no id="" etc

If you do

$quote_id = $_POST['quote_id'];

 

on file2.php (assuming file2.php is addguestbook.php) then that will echo out the value of the form field "quote_id" that the user entered in file1.php. So that is how you would transfer the ID.

 

Then to pass it in the URL, just do this.

 

<?php

echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"3; URL=admin_modprocess.php?idr=$quote_id&table=jobs\">";

?>

not having much luck here, is this correct?

<? include 'admin_header.php'; 
if($_SESSION['type'] == "admin")
{
$quote_id = $_POST['quote_id'];

$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);





//check if query successful 
if($result){
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"3; URL=admin_modprocess.php?idr=$quote_id&table=jobs\">"; //this is the link that shoudl use the id and redirect

}

else {
echo "ERROR";
}
mysql_close();
}
include 'admin_footer.php';
?>

 

 

Yeah...looks good to me. Does it not redirect, or what is happening?

 

Try replacing this line:

echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"3; URL=admin_modprocess.php?idr=$quote_id&table=jobs\">";

 

With this:

header("Location: admin_modprocess.php?idr=$quote_id&table=jobs");

 

file2.php is addguestbook.php, right?

tried the header thing, getting the exact same error as before, heres code now:

<? include 'admin_header.php'; 
if($_SESSION['type'] == "admin")
{
$quote_id = $_POST['quote_id'];
$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);





//check if query successful 
if($result){
echo "header("Location: admin_modprocess.php?idr=$quote_id&table=jobs");"; //this is the link that shoudl use the id and redirect

}

else {
echo "ERROR";
}
mysql_close();
}
include 'admin_footer.php';
?>

 

the error is:

 

Parse error: syntax error, unexpected T_VARIABLE in /home/morow/public_html/admin/addguestbook.php on line 4

 

line 4 is

$quote_id = $_POST['quote_id'];

You don't echo the header function.

 

Try using this exact code:

 

<?php
include 'admin_header.php'; 
if($_SESSION['type'] == "admin")
{
$quote_id = $_POST['quote_id'];
$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);





//check if query successful 
if($result){
header("Location: admin_modprocess.php?idr=$quote_id&table=jobs"); //this is the link that shoudl use the id and redirect

}

else {
echo "ERROR";
}
mysql_close();
}
include 'admin_footer.php';
?>

got this error with the exact code from above

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/morow/public_html/admin/addguestbook.php on line 2

 

here is the code once again:

<?php
include 'admin_header.php'; 
if($_SESSION['type'] == "admin")
{
$quote_id = $_POST['quote_id'];
$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);





//check if query successful 
if($result){
header("Location: admin_modprocess.php?idr=$quote_id&table=jobs"); //this is the link that shoudl use the id and redirect

}

else {
echo "ERROR";
}
mysql_close();
}
include 'admin_footer.php';
?>

 

 

Strange, because I put in that exact code on my server, and it worked fine.

 

Try changing this:

$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";

 

To:

$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('$quote_id','$actual_time','$cat','$subcat','$machine_time','$setup','$notes','$complete')";

 

Ok here is where the problem is:

 

Change to this for this line of code:

 

$quote_id = $_POST["quote_id"]; //The double quotes are necessary here

 

And this line of code here:

 

if($_SESSION[type] == "admin") //Notice no apostrophe here

 

That should clear it up for you

why am i getting this error?!??~!!? gah!

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/morow/public_html/admin/addguestbook.php on line 2

line2=include 'admin_header.php'; 

 

<?php
include 'admin_header.php'; 
if($_SESSION['type'] == "admin")
{
$quote_id = $_POST['quote_id'];
$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);





//check if query successful 
if($result){
header("Location: admin_modprocess.php?idr=$quote_id&table=jobs"); //this is the link that shoudl use the id and redirect

}

else {
echo "ERROR";
}
mysql_close();
}
include 'admin_footer.php';
?>

 

 

here is admin_header.php keep in mind, this script works perfectly fine on all the other pages.

<?
// this is the header file for all admin pages.
// this file also contains info on connecting to the database and will return an error if the connection to the database is unsuccessful in any way. 

session_start();

$link = mysql_connect('localhost', '***', '***');
if(!$link)
{
die('Could not connect: ' . mysql_error());

}

mysql_select_db('***', $link);
$currentdate = date('Y')."-".date('m')."-".date('d');



function loadcurstate($prov,$curprov)
{

if($prov == "BC")
{$fullname = "British Columbia";}
if($prov == "AB")
{$fullname = "Alberta";}
if($prov == "MB")
{$fullname = "Manitoba";}
if($prov == "SK")
{$fullname = "Saskatchewan";}
if($prov == "ON")
{$fullname = "Ontario";}
if($prov == "QC")
{$fullname = "Quebec";}
if($prov == "NT")
{$fullname = "North West Territories";}
if($prov == "YK")
{$fullname = "Yukon";}
if($prov == "NU")
{$fullname = "Nunavut";}
if($prov == "NB")
{$fullname = "New Brunswick";}
if($prov == "NS")
{$fullname = "Nova Scotia";}
if($prov == "PE")
{$fullname = "PEI";}
if($prov == "NL")
{$fullname = "New Foundland";}
if($prov == "NB")
{$fullname = "New Brunswick";}
if($prov == "AL")
{$fullname = "Alabama";}
if($prov == "AK")
{$fullname = "Alaska";}
if($prov == "AS")
{$fullname = "American Samoa";}
if($prov == "AZ")
{$fullname = "Arizona";}
if($prov == "AR")
{$fullname = "Arkansas";}
if($prov == "CA")
{$fullname = "California";}
if($prov == "CO")
{$fullname = "Colorado";}
if($prov == "CT")
{$fullname = "Connecticut";}
if($prov == "DE")
{$fullname = "Delaware";}
if($prov == "DC")
{$fullname = "District of Columbia";}
if($prov == "FM")
{$fullname = "Federated States of Micronesia";}
if($prov == "FL")
{$fullname = "Florida";}
if($prov == "GA")
{$fullname = "Georgia";}
if($prov == "GU")
{$fullname = "Guam";}
if($prov == "HI")
{$fullname = "Hawaii";}
if($prov == "ID")
{$fullname = "Idaho";}
if($prov == "IL")
{$fullname = "Illinois";}
if($prov == "IN")
{$fullname = "Indiana";}
if($prov == "IA")
{$fullname = "Iowa";}
if($prov == "KS")
{$fullname = "Kansas";}
if($prov == "KY")
{$fullname = "Kentucky";}
if($prov == "LA")
{$fullname = "Louisiana";}
if($prov == "ME")
{$fullname = "Maine";}
if($prov == "MH")
{$fullname = "Marshall Islands";}
if($prov == "MD")
{$fullname = "Maryland";}
if($prov == "MA")
{$fullname = "Massachusetts";}
if($prov == "MI")
{$fullname = "Michigan";}
if($prov == "MN")
{$fullname = "Minnesota";}
if($prov == "MS")
{$fullname = "Mississippi";}
if($prov == "MO")
{$fullname = "Missouri";}
if($prov == "MT")
{$fullname = "Montana";}
if($prov == "NE")
{$fullname = "Nebraska";}
if($prov == "NV")
{$fullname = "Nevada";}
if($prov == "NH")
{$fullname = "New Hampshire";}
if($prov == "NJ")
{$fullname = "New Jersey";}
if($prov == "NB")
{$fullname = "New Brunswick";}
if($prov == "NM")
{$fullname = "New Mexico";}
if($prov == "NY")
{$fullname = "New York";}
if($prov == "NC")
{$fullname = "North Carolina";}
if($prov == "ND")
{$fullname = "North Dakota";}
if($prov == "MP")
{$fullname = "Northern Mariana Islands";}
if($prov == "OH")
{$fullname = "Ohio";}
if($prov == "OK")
{$fullname = "Oklahoma";}
if($prov == "OR")
{$fullname = "Oregon";}
if($prov == "PW")
{$fullname = "Palau";}
if($prov == "PA")
{$fullname = "Pennsylvania";}
if($prov == "PR")
{$fullname = "Puerto Rico";}
if($prov == "RI")
{$fullname = "Rhode Island";}
if($prov == "SC")
{$fullname = "South Carolina";}
if($prov == "SD")
{$fullname = "South Dakota";}
if($prov == "TN")
{$fullname = "Tennessee";}
if($prov == "TX")
{$fullname = "Texas";}
if($prov == "UT")
{$fullname = "Utah";}
if($prov == "VT")
{$fullname = "Vermont";}
if($prov == "VI")
{$fullname = "Virgin Islands";}
if($prov == "VA")
{$fullname = "Virginia";}
if($prov == "WA")
{$fullname = "Washington";}
if($prov == "WV")
{$fullname = "West Virginia";}
if($prov == "WI")
{$fullname = "Wisconsin";}
if($prov == "WY")
{$fullname = "Wyoming";}





echo "<option ";

if($curprov==$prov){echo"selected ";}
echo "value=\"".$prov."\">".$fullname."</option>";
}


function loadcurcat($prov,$curprov)
{


echo "<option ";

if($curprov==$prov){echo"selected ";}
echo "value='".$prov."'>".$fullname."</option>";
}




function headerdisplay($a,$cat,$subcat)
{
if(!isset($_GET['order']))
{$neworder = "asc";}

if($_GET['order'] == "asc")
{$neworder = "desc";}

if($_GET['order'] == "desc")
{$neworder = "asc";}

if($cat!="")
{$cat = "&cat=".$cat;}

if($subcat!="")
{$subcat = "&subcat=".$subcat;}




echo "<td class=header><a href=\"".$PHP_SELF."?item=".$a."&order=".$neworder.$cat.$subcat."\" class=\"WhiteTableLink\">".$a."</a></font></td>\n";
}



function headerdisplaydlr($a,$prov,$city)
{
if(!isset($_GET['order']))
{$neworder = "asc";}

if($_GET['order'] == "asc")
{$neworder = "desc";}

if($_GET['order'] == "desc")
{$neworder = "asc";}

if($prov!="")
{$prov = "&prov=".$prov;}

if($city!="")
{$city = "&city=".$city;}




echo "<td class=\"header\"><span class=\"whitebody\"><a href=\"".$PHP_SELF."?item=".$a."&order=".$neworder.$prov.$city."\" class=\"WhiteTableLink\">".$a."</a></span></td>\n";
}








function itemdisplay($b)
{
if($b == null){echo "\n<td class=list> </td>";} else {echo "\n<td class=list>".$b."</td>";}





}

function loadcities($a)
{
// spot for entering data for all cities of each province detected within the database

$loadcity = "SELECT DISTINCT city FROM dealers WHERE prov='".$a."' ORDER BY city";
$clist = mysql_query($loadcity);


while($cities = mysql_fetch_array($clist))
{
echo "\"('".str_replace("'", "&&&",$cities["city"])."')\",";
}


}



function loadsubcat($a)
{
// spot for entering data for all cities of each province detected within the database

$loadsub = "SELECT subcat FROM subcategory WHERE cat='".$a."'";
$clist = mysql_query($loadsub);
$subcats = mysql_fetch_array($clist);

do
{
echo "\"('".$subcats["subcat"]."')\",";
}
while($subcats = mysql_fetch_array($clist));

}







function loadimage($variable,$folder="pdf",$id)
{
if($_FILES[$variable]['name']!="")
		{// if there was a new file selected
		$photo = $_FILES[$variable]['name'];

		// section to process the photo
		$photovar = "../".$folder."/".$photo;


		move_uploaded_file($_FILES[$variable]['tmp_name'], $photovar);


		$imageupdate = "UPDATE products SET ".$variable."='".$photo."' WHERE id='".$id."'";
		echo $imageupdate."<br>";
		mysql_query($imageupdate);
		}
}






?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Morowat Global Administration Page</title>


<link rel="stylesheet" type="text/css" href="admin_style.css">






<script language="JavaScript" type="text/JavaScript">
<!--
function go()
  {if (document.category.cat.options 
   [document.category.cat.selectedIndex].value != "none") 
      {location = document.category.cat.options 
       [document.category.cat.selectedIndex].value 
      } 
   }
//-->
</script>



<!--
// == This Script Free To Use Providing This Notice Remains == //                                                                 
// == This Script Has Been Found In The http://www.DesignerWiz.com Javascript Public Archive Library == // 
// == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == //
--><SCRIPT LANGUAGE="JavaScript">
<!-- Begin


<?

$catsql = "SELECT DISTINCT cat FROM category";
$cats = mysql_query($catsql);
$category = mysql_fetch_array($cats);

do 

{
echo "var ".$category["cat"]."Array =  new Array(\"('Select Sub-Category','',true,true)\",";
loadsubcat($category["cat"]);
echo "\"('')\"";
echo ");\n";

} while ($category = mysql_fetch_array($cats));

?>


function populateSubcat(inForm,selected) {
var selectedArray = eval(selected + "Array");
while (selectedArray.length < inForm.Subcat.options.length) {
inForm.Subcat.options[(inForm.Subcat.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {
eval("inForm.Subcat.options[i]=" + "new Option" + selectedArray[i]);
}
if (inForm.cat.options[0].value == '') {
inForm.cat.options[0]= null;
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0);
}
else {   	
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0);
}
}
}
}
}
function populateUstate(inForm,selected) {  
var stateArray =  new Array("('Select State','',true,true)",
"('Alabama')",
"('Alaska')",
"('Arizona')",
"('Arkansas')",
"('California')",
"('Colorado')",
"('Connecticut')",
"('Delaware')",
"('Columbia')",
"('Florida')",
"('Georgia')",
"('Hawaii')",
"('Idaho')",
"('Illinois')",
"('Indiana')",
"('Iowa')",
"('Kansas')",
"('Kentucky')",
"('Louisiana')",
"('Maine')",
"('Maryland')",
"('Massachusetts')",
"('Michigan')",
"('Minnesota')",
"('Mississippi')",
"('Missouri')",
"('Montana')",
"('Nebraska')",
"('Nevada')",
"('New Hampshire')",
"('New Jersey')",
"('New Mexico')",
"('New York')",
"('North Carolina')",
"('North Dakota')",
"('Ohio')",
"('Oklahoma')",
"('Oregon')",
"('Pennsylvania')",
"('Rhode Island')",
"('South Carolina')",
"('South Dakota')",
"('Tennessee')",
"('Texas')",
"('Utah')",
"('Vermont')",
"('Virginia')",
"('Washington')",
"('West Virginia')",
"('Wisconsin')",
"('Wyoming')");
if (selected == 'USA') {
for (var i=0; i < stateArray.length; i++) {
eval("inForm.Subcat.options[i]=" + "new Option" + stateArray[i]);
}
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0)
}
else {    	
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0)
}
}
}
}
else {
}  
if (selected == 'Other') {
newSubcat = "";
while (newSubcat == ""){
newSubcat=prompt ("Please enter the name of your Sub-category.", "");
}
if (newSubcat != null) {
inForm.Subcat.options[(inForm.Subcat.options.length-1)]=new Option(newSubcat,newSubcat,true,true);
inForm.Subcat.options[inForm.Subcat.options.length]=new Option('Other, not listed','Other');
}
}
if(inForm.Subcat.options[0].text == 'Select Sub-Category') {
inForm.Subcat.options[0]= null;
}
}
// End -->
</script>	






<?

if (eregi('dlr',$PHP_SELF))
{
?>



<!--
// == This Script Free To Use Providing This Notice Remains == //                                                                 
// == This Script Has Been Found In The http://www.DesignerWiz.com Javascript Public Archive Library == // 
// == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == //
--><SCRIPT LANGUAGE="JavaScript">
<!-- Begin

var BCArray =  new Array( "('Select city','',true,true)",

<?
loadcities("BC")
?>
"('Other')"
);

var ABArray =  new Array( "('Select city','',true,true)",
<?
loadcities("AB")
?>
"('Other')"
);

var MBArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MB")
?>


"('Other')"
);

var SKArray =  new Array( "('Select city','',true,true)",
<?
loadcities("SK")
?>
"('Other')"
);

var ONArray =  new Array( "('Select city','',true,true)",
<?
loadcities("ON")
?>
"('Other')"
);

var QCArray =  new Array( "('Select city','',true,true)",
<?
loadcities("QC")
?>
"('Other')"
);

var NTArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NT")
?>
"('Other')"
);

var YKArray =  new Array( "('Select city','',true,true)",
<?
loadcities("YK")
?>
"('Other')"
);

var NUArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NU")
?>
"('Other')"
);

var NBArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NB")
?>
"('Other')"
);

var NSArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NS")
?>
"('Other')"
);

var PEArray =  new Array( "('Select city','',true,true)",
<?
loadcities("PE")
?>
"('Other')"
);

var NLArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NL")
?>
"('Other')"
);

var ALArray =  new Array( "('Select city','',true,true)",
<?
loadcities("AL")
?>
"('Other')"
);

var AKArray =  new Array( "('Select city','',true,true)",
<?
loadcities("AK")
?>
"('Other')"
);

var ASArray =  new Array( "('Select city','',true,true)",
<?
loadcities("AS")
?>
"('Other')"
);

var AZArray =  new Array( "('Select city','',true,true)",
<?
loadcities("AZ")
?>
"('Other')"
);

var ARArray =  new Array( "('Select city','',true,true)",
<?
loadcities("AR")
?>
"('Other')"
);

var CAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("CA")
?>
"('Other')"
);

var COArray =  new Array( "('Select city','',true,true)",
<?
loadcities("CO")
?>
"('Other')"
);


var CTArray =  new Array( "('Select city','',true,true)",
<?
loadcities("CT")
?>
"('Other')"
);

var DEArray =  new Array( "('Select city','',true,true)",
<?
loadcities("DE")
?>
"('Other')"
);

var DCArray =  new Array( "('Select city','',true,true)",
<?
loadcities("DC")
?>
"('Other')"
);

var FMArray =  new Array( "('Select city','',true,true)",
<?
loadcities("FM")
?>
"('Other')"
);

var FLArray =  new Array( "('Select city','',true,true)",
<?
loadcities("FL")
?>
"('Other')"
);

var GAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("GA")
?>
"('Other')"
);

var GUArray =  new Array( "('Select city','',true,true)",
<?
loadcities("GU")
?>
"('Other')"
);

var HIArray =  new Array( "('Select city','',true,true)",
<?
loadcities("HI")
?>
"('Other')"
);

var IDArray =  new Array( "('Select city','',true,true)",
<?
loadcities("ID")
?>
"('Other')"
);

var ILArray =  new Array( "('Select city','',true,true)",
<?
loadcities("IL")
?>
"('Other')"
);

var INArray =  new Array( "('Select city','',true,true)",
<?
loadcities("IN")
?>
"('Other')"
);

var IAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("IA")
?>
"('Other')"
);

var KSArray =  new Array( "('Select city','',true,true)",
<?
loadcities("KS")
?>
"('Other')"
);

var KYArray =  new Array( "('Select city','',true,true)",
<?
loadcities("KY")
?>
"('Other')"
);

var LAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("LA")
?>
"('Other')"
);

var MEArray =  new Array( "('Select city','',true,true)",
<?
loadcities("ME")
?>
"('Other')"
);

var MHArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MH")
?>
"('Other')"
);

var MDArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MD")
?>
"('Other')"
);

var MAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MA")
?>
"('Other')"
);

var MIArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MI")
?>
"('Other')"
);

var MNArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MN")
?>
"('Other')"
);

var MSArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MS")
?>
"('Other')"
);

var MOArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MO")
?>
"('Other')"
);

var MTArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MT")
?>
"('Other')"
);

var NEArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NE")
?>
"('Other')"
);

var NVArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NV")
?>
"('Other')"
);

var NHArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NH")
?>
"('Other')"
);

var NJArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NJ")
?>
"('Other')"
);

var NMArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NM")
?>
"('Other')"
);

var NYArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NY")
?>
"('Other')"
);

var NCArray =  new Array( "('Select city','',true,true)",
<?
loadcities("NC")
?>
"('Other')"
);

var NDArray =  new Array( "('Select city','',true,true)",
<?
loadcities("ND")
?>
"('Other')"
);

var MPArray =  new Array( "('Select city','',true,true)",
<?
loadcities("MP")
?>
"('Other')"
);

var OHArray =  new Array( "('Select city','',true,true)",
<?
loadcities("OH")
?>
"('Other')"
);

var OKArray =  new Array( "('Select city','',true,true)",
<?
loadcities("OK")
?>
"('Other')"
);

var ORArray =  new Array( "('Select city','',true,true)",
<?
loadcities("OR")
?>
"('Other')"
);

var PWArray =  new Array( "('Select city','',true,true)",
<?
loadcities("PW")
?>
"('Other')"
);

var PAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("PA")
?>
"('Other')"
);

var PRArray =  new Array( "('Select city','',true,true)",
<?
loadcities("PR")
?>
"('Other')"
);

var RIArray =  new Array( "('Select city','',true,true)",
<?
loadcities("RI")
?>
"('Other')"
);

var SCArray =  new Array( "('Select city','',true,true)",
<?
loadcities("SC")
?>
"('Other')"
);

var SDArray =  new Array( "('Select city','',true,true)",
<?
loadcities("SD")
?>
"('Other')"
);

var TNArray =  new Array( "('Select city','',true,true)",
<?
loadcities("TN")
?>
"('Other')"
);

var TXArray =  new Array( "('Select city','',true,true)",
<?
loadcities("TX")
?>
"('Other')"
);

var UTArray =  new Array( "('Select city','',true,true)",
<?
loadcities("UT")
?>
"('Other')"
);

var VTArray =  new Array( "('Select city','',true,true)",
<?
loadcities("VT")
?>
"('Other')"
);

var VIArray =  new Array( "('Select city','',true,true)",
<?
loadcities("VI")
?>
"('Other')"
);

var VAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("VA")
?>
"('Other')"
);

var WAArray =  new Array( "('Select city','',true,true)",
<?
loadcities("WA")
?>
"('Other')"
);

var WVArray =  new Array( "('Select city','',true,true)",
<?
loadcities("WV")
?>
"('Other')"
);

var WIArray =  new Array( "('Select city','',true,true)",
<?
loadcities("WI")
?>
"('Other')"
);

var WYArray =  new Array( "('Select city','',true,true)",
<?
loadcities("WY")
?>
"('Other')"
);





function populatecity(inForm,selected) {
var selectedArray = eval(selected + "Array");
while (selectedArray.length < inForm.city.options.length) {
inForm.city.options[(inForm.city.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {

newcity = selectedArray[i].replace("&&&","\\'")

eval("inForm.city.options[i]=" + "new Option" + newcity);
}
if (inForm.prov.options[0].value == '') {
inForm.prov.options[0]= null;
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0);
}
else {
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0);
}
}
}
}
}
function populateUSstate(inForm,selected) {  
var stateArray =  new Array("('Select State','',true,true)",
"('Alabama')",
"('Alaska')",
"('Arizona')",
"('Arkansas')",
"('California')",
"('Colorado')",
"('Connecticut')",
"('Delaware')",
"('Columbia')",
"('Florida')",
"('Georgia')",
"('Hawaii')",
"('Idaho')",
"('Illinois')",
"('Indiana')",
"('Iowa')",
"('Kansas')",
"('Kentucky')",
"('Louisiana')",
"('Maine')",
"('Maryland')",
"('Massachusetts')",
"('Michigan')",
"('Minnesota')",
"('Mississippi')",
"('Missouri')",
"('Montana')",
"('Nebraska')",
"('Nevada')",
"('New Hampshire')",
"('New Jersey')",
"('New Mexico')",
"('New York')",
"('North Carolina')",
"('North Dakota')",
"('Ohio')",
"('Oklahoma')",
"('Oregon')",
"('Pennsylvania')",
"('Rhode Island')",
"('South Carolina')",
"('South Dakota')",
"('Tennessee')",
"('Texas')",
"('Utah')",
"('Vermont')",
"('Virginia')",
"('Washington')",
"('West Virginia')",
"('Wisconsin')",
"('Wyoming')");
if (selected == 'USA') {
for (var i=0; i < stateArray.length; i++) {
eval("inForm.city.options[i]=" + "new Option" + stateArray[i]);
}
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0)
}
else {    	
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0)
}
}
}
}
else {
}  
if (selected == 'Other') {
newcity = "";
while (newcity == ""){
newcity=prompt ("Please enter the name of your city.", "");
}
if (newcity != null) {
inForm.city.options[(inForm.city.options.length-1)]=new Option(newcity,newcity,true,true);
inForm.city.options[inForm.city.options.length]=new Option('Other, not listed','Other');
}
}
if(inForm.city.options[0].text == 'Select city') {
inForm.city.options[0]= null;
}
}



// End -->
</script>


<?

}


?>

<script type="text/javascript">
<!--
function navConfirm(loc) {
if (confirm('Did you save your work?')) {
window.location.href = loc;
}
return false; // cancel the click event always
}
//-->
</script>


<script language="javascript" src="cal2.js"></script>
<script language="javascript" src="cal_conf2.js"></script>



</head>

<body bgcolor="#dddddd" marginwidth="0" style="margin: 0px; padding: 0px;" <?if(eregi('dlfgsdr',$PHP_SELF)){echo "onload=\"inForm.city.options[inForm.city.options.length]=new Option('Other, not listed','Other');\"";}?>>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
		<tr height="12">
			<td valign="top" height="12">
				<table width=100% border="0" cellspacing="0" align=center valign=top cellpadding="0">
					<tr>
						<td valign="bottom" bgcolor="#000000" width="210"><img src="images/adminhdr.gif">
						<td valign="bottom" bgcolor="#000000"><span class="whiteHed"> </span></td>
					</tr>
					<tr>
						<td colspan="2" valign="bottom" bgcolor="#330000"><?
include 'admin_menu.php';include 'editor.php';
?></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="tmpBody" valign="top">

 

 

Okay...lets start commenting certain lines out to figure out where the error actually is.

 

So lets comment this chunk of code out and see if it works:

$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);

 

Your new code will look like this:

<?php
include 'admin_header.php'; 
if($_SESSION['type'] == "admin")
{
$quote_id = $_POST['quote_id'];

/*
$sql="INSERT INTO guestbook (quote_id,actual_time,cat,subcat,machine_time,setup,notes,complete)
VALUES ('".$quote_id."','".$actual_time."','".$cat."','".$subcat."','".$machine_time."','".$setup."','".$notes."','".$complete."')";
$result=mysql_query($sql);
*/


//check if query successful 
if($result){
header("Location: admin_modprocess.php?idr=$quote_id&table=jobs"); //this is the link that shoudl use the id and redirect

}

else {
echo "ERROR";
}
mysql_close();
}
include 'admin_footer.php';
?>

What text editor are you using? I just looked the error up on google and I guess some text editors can cause this error as they add unnecessary white spaces, and change the format of the code.

 

Seems like the error comes a lot especially if you use Dreamweaver.

Archived

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

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