Jump to content

Recommended Posts

Hello to all you wonderful people!

 

I have a website back end and I created a page which lets people edit orders that have been placed. great..

 

actually not really, because it will not submit!!!

 

For some reason nothing happens when i click on submit, can anybody tell me what i did wrong?

(btw, the form fills itself depending on whos profile you are editing.)

 

 

<html>
<?php 
include("head.php");
include("dbcon.php"); 

$connote =  $_GET["connote"];
$connote = "'$connote'";
$connoteResult = mysql_query("SELECT * FROM Orders WHERE connote = " . $connote);

while($row = mysql_fetch_array($connoteResult))
  {

		$email= $row['email'];
		$zip = $row['zip'];
		$warranty = $row['warrantyLength'];
		$orderNotes = $row['orderNotes'];
		$later = $row['later'];// determines a later date
		$laterDate = $row['laterDate'];
		$connote = $row['connote'];
		$status = $row['status'];
		$name = $row['firstName'];
		$held = $row['held'];
		$deliveryNotes = $row['tntNote'];
		$paymentMethod = $row['paymentMethod'];
		$customerID = $row['customerID'];
		$date = $row['date'];
		$status = $row['status'];
		 }	



$customerIDfinder = mysql_query("SELECT customerID FROM Orders WHERE connote =" . $customerID );

while($row = mysql_fetch_array($customerIDfinder))
	  {	
			$customerID = $row['customerID'];
        	}


//get the customer id from the other query 
$customerResult = mysql_query("SELECT * FROM CustomerTable WHERE customerID =" . $customerID );

while($row = mysql_fetch_array($customerResult))
  {	 
	    $firstName = $row['firstName'];
		$lastName = $row['lastName'];
		$aCode = $row['aCode'];
		$phoneNumber = $row['phoneNumber'];
		$mobNumber = $row['mobNumber'];
		$email = $row['email'];
		$customerNotes = $row['customerNotes'];
		$customerAddress = $row['customerAddress'];
		$suburb = $row['suburb'];
		$state = $row['state'];
		$zip = $row['zip'];
		$street = $row['street'];

     }


	// set the form to refill the details in by itself

	 $QLD = $row['state'] == "QLD" ? ' selected="selected"' : '';
	 $NSW = $row['state'] == "NSW" ? ' selected="selected"' : '';
	 $WA = $row['state'] == "WA" ? ' selected="selected"' : '';
	 $SA = $row['state'] == "SA" ? ' selected="selected"' : '';
	 $TAS = $row['state'] == "TAS" ? ' selected="selected"' : '';
	 $NT = $row['state'] == "NT" ? ' selected="selected"' : '';
	 $VIC = $row['state'] == "VIC" ? ' selected="selected"' : ''; 
	 $ACT = $row['state'] == "ACT" ? ' selected="selected"' : ''; 
	 $state = $row['state'];

	$yes = $row['later'] == "yes" ? ' selected="selected"' : ''; 
	$no = $row['later'] == "no" ? ' selected="selected"' : ''; 
	//$later = $row['later'];

	// Add the status change option in the backend version
  $yesInstall = $install == "yes" ? 'selected="selected"' : ''; 
  $noInstall = $install == "no" ? 'selected="selected"' : ''; 




	  ?>


<body>

<div id="wrapper">


<?php include("nav.php"); ?> <!-- includes the nav bar -->


		  
	<div id="content">

		<div id="orders">
		<br>
<br>

<form name="form1" method="post" action="updateEngine.php?connote=<?php echo "$connote" ?>" >

Edit the Order below, then submit.
<br>
<br>
<fieldset>
<legend><strong>Order Details</strong></legend>
<table width="900">

<td width="200" class="display"><strong>Products Ordered</strong></td>
<td width="350">
<?php 

function getProduct($id){

$productFinder = mysql_query("SELECT name FROM Products WHERE ID =" . $id );

while($row = mysql_fetch_array($productFinder))
	  {	
			$product = $row['name'];
        	}

     return $product;
}

$order = mysql_query("SELECT * FROM OrderProducts WHERE OrderId =" . "'$connote'" );

$products = array();
   while($row = mysql_fetch_array($order))
        {   
            array_push($products,$row['ProductId']); //place product ids in array
                 
        }
//output array
$i = 0;
while($i < sizeof($products)){
echo getProduct($products[$i]);
echo " \n";
$i++;
}


?><br>
<br>

</td>

</td>

<tr>
<td width="200"><strong>Product</strong> </td>
<td width="350">
<?php

echo" <select name='product[]' id='product' size='5' tabindex='1' class='validate required product productMsg' multiple>";                      //start the select box 

$results= mysql_query("SELECT ID, name FROM Products ORDER BY ID asc",$connection); 
$id = "ID";
$idname = "Name"; 
echo mysql_error(); 

	if (mysql_Numrows($results)>0)                            //if there are records in the fields
	{ 
	  $numrows=mysql_NumRows($results);                       //count them
	  $x=0; 
	  while ($x<$numrows){   //loop through the records
		$theId=mysql_result($results,$x,$id);                 //place each record in the variable everytime we loop
		$theName=mysql_result($results,$x,$idname);
		echo "<option value=\"$theId\">$theName</option>\n";  //and place it in the select
		$x++;
	  }
	}
echo "</select>";  //close the select

//DONE



?>
</td>
<td  id ="productMsg"  class="display">
</td>

<td width="200" class="display"><strong>Warranty:</strong></td>
<td width="350">
  <select name="warranty">
	<option value="1">1</option>
	<option value="3">3</option>
	</select></td>
<td></td>
</td>

</tr>

      		<tr>
          		<td width="130"><strong>Order Notes:</strong></td>
          		<td><textarea name="orderNotes" cols="40" rows="4"><?php echo"$orderNotes" ?></textarea></td>
      	    </tr>

		<tr>
          		<td width="190"><strong>Send at later date:</strong></td>
          		<td><select name="later" id="later">
			<option value="no" <?=$no ?>>no</option>
			<option value="yes" <?=$no ?>>yes</option>
			</select> (If so please insert date)
			</td>

		</tr>

		<tr>
		<td width="190"><strong>Date:</strong></td>
			<td><input type="text" name="laterDate" value="<?php echo"$laterDate" ?>" size="10"></td>
      	    </tr>
  
</table>
</fieldset>

	<br>
	<br>



        <fieldset>
        <legend><strong>Customer Information</strong></legend>
        <table width="900">
    		<tr>
        		<td width="200"><strong>First Name:</strong> </td>
        		<td width="350"><input type="text" name="firstName" value="<?php echo"$firstName" ?>" size="40" tabindex="2" id="firstName" class="validate required none firstNameMsg"/></td>
        		<td  id ="firstNameMsg"  class="display"> </td>
    	    </tr>

    	    <tr>
        		<td width="130"><strong>Last Name: </strong></td>
        		<td width="350"><input type="text" name="lastName" value="<?php echo"$lastName" ?>" size="40" tabindex="3" id="lastName" class="validate required none lastNameMsg"/></td>
        		<td id ="lastNameMsg"  class="display"> </td>
    	    </tr>
    	    
    	    <tr>
        		<td width="130"><strong>Phone Number:</strong> </td>
        		<td width="3">
        		    <input type="text" name="phoneNumber" value="<?php echo"$phoneNumber" ?>" size="15" tabindex="5" id="phoneNumber" class="validate required number phoneNumberMsg"/>
        		</td>
        		<td id ="aCodeMsg"  class="display"> </td>
        		<td id ="phoneNumberMsg"  class="display"> </td>
    	    </tr>
    	    
    	    <tr>
        		<td width="130"><strong>Mobile Number:</strong> </td>
        		<td width="20"><input type="text" name="mobNumber" value="<?php echo"$mobNumber" ?>" size="20" tabindex="6" id="mobNumber" class="validate notrequired number mobileNumberMsg"/></td>
        		<td id ="mobileNumberMsg"  class="display"></td>
    	    </tr>
    	    
    	    <tr>
        		<td><strong>Email:</strong> </td>
        		<td><input type="text" name="email" value="<?php echo"$email" ?>" tabindex="7"  id="email" class="validate required email emailmsg" /></td>
    		    <td id="emailmsg" class="display"> </td>
        </tr>
        
        <tr>
           <td><strong>Notes about the customer:</strong></td>
           <td><textarea name="customerNotes" tabindex="8" cols="40" rows="4"><?php echo"$customerNotes" ?></textarea></td>
        </tr>

    	</table>
    	</fieldset>
	<br>
	<br>
    	<fieldset>
        <legend><strong>Customer Address</strong></legend>
        <table width="900">
    	    <tr>
        		<td width="130"><strong>Street</strong></td>
        		<td width="130"><input type="text" value="<?php echo"$street" ?>" name="street" size="50" tabindex="9" id="street" class="validate required none streetMsg"/></td>
        		<td class="display"> </td>
    	    </tr>
    
    	       <tr>
        		<td width="130"><strong>Suburb</strong></td>
        		<td width="130"><input type="text" value="<?php echo"$suburb" ?>" name="street" size="50" tabindex="9" id="street" class="validate required none streetMsg"/></td>
        		<td class="display"> </td>
    	    </tr>

    	    <tr>
        		<td width="130"><strong>State: </strong></td>
        		<td width="130">
			  <select name="state">
				  <option value="ACT"<?=$ACT ?>>ACT</option>
				  <option value="QLD"<?=$QLD ?>>QLD</option>
				  <option value="NSW"<?=$NSW ?>>NSW</option>
				  <option value="VIC"<?=$VIC ?>>VIC</option>
				  <option value="SA"<?=$SA ?>>SA</option>
				  <option value="WA"<?=$WA ?>>WA</option>
				  <option value="TAS"<?=$TAS ?>>TAS</option>
				  <option value="NT"<?=$NT ?>>NT</option>
			  </select>
                </td>
        		<td id ="stateMsg"></td>
        	</tr>

      		<tr>
          		<td width="130"><strong>Post Code:</strong> </td>
          		<td width="130"><input type="text" name="zip" value="<?php echo"$zip" ?>" size="4" maxlength="4" tabindex="12" id="zip" class="validate required zip zipMsg"/></td>
          		<td id ="zipMsg"  class="display"> </td>
  	        </tr>

    	</table>
    	</fieldset>
    	
    	<br><br>
    	<fieldset>
        <legend><strong>Delivery Notes</strong></legend>
        <table width="900">

        <tr>
           <td>Delivery notes</td>
           <td><textarea name="tntNote" wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.tntNote,this.form.remLen,80);"
	              onKeyUp="textCounter(this.form.tntNote,this.form.remLen,80);"><?php echo"$deliveryNotes" ?></textarea></td>
	       <td><input readonly type=text name=remLen size=3 maxlength=3 value="49"> characters left</font></td>
	    </tr>


        <tr>
           <td>Install:</td>
           <td>
			<select name="install">
			<option value="no" <?=$noInstall ?>>no</option>
			<option value="yes" <?=$yesInstall ?>>yes</option>
			</select>
	</td>
	      
	    </tr>

        </table>
        </fieldset>
	<br>
<br>


<fieldset>
        <legend><strong>Payment and Billing</strong></strong></legend>
        <table width="900">

        <tr>
           <td><strong>Payment Type:</strong></td>
           <td  width="130"> 
	  <select name="paymentMethod">
	  <option value="cc">Credit Card Phone</option> 
	  <option value="ccs">Credit Card Store</option> 
	  <option value="cco">Credit Card Online</option>
	  <option value="dd">Direct Deposit</option>
	  <option value="cod">Cash on Delivery</option> 
	  <option value="cs">Cash in Store</option> 
	  <option value="ch">Cheque</option> 
	  </select>	
	  
	 </td>
	       <td  width="130"></td>
	    </tr>

       <tr>
           <td><strong>Status:</strong></td>
           <td  width="130"><?php echo"$status" ?></td>
	       <td  width="130"></td>
	    </tr>

        </table>

        </fieldset>
	<br> <input name="Submit" type="button" value="Submit"></form>


	  <br><br><br>


       </div>
   </div>
    </div>
    </body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/134337-solved-form-will-not-submit/
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.