Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-20-2010, 10:24 PM reset button
Extreme Talker

Posts: 173
Trades: 0
Normally this form would be populated by the db but I would also like to use it to initiate a new project as well; however, I cannot figure out how to determine if the user has hit the reset button.

PHP Code:
<?php
// start session 
session_start();
// set up some global variables 
@include 'menu.php';
@include 
'menu_project.php';
echo 
'<link rel="stylesheet" type="text/css" href="style/form_style.css" />';
if(isset(
$_POST['project'])){
$field_list=array( 'work_flow',   'network_number''documentum',   'pdit',    
     
'xfer_service',   'service_request''wt_accept',   'wt_ship',   
     
'aoa',     'inco_term',  'inco_place',   'rdd',     
     
'transit_time',   'ship_date',  'st_cd',    'float',
     
'st_courier',   'st_email',   'st_ftp',    'review_period',
     
'submit_office',  'document_level''margin_level',   'contigency',
     
'financials',   'owner',   'customer',    'consultant');
$field_list_2=array('project','project_desc');
 foreach (
$_POST as &$field){
  
$field=sanitizeMySQL($field);
 }  
}
//Update Project details
if(!empty($_POST['project_id'])){
 
update("tbl_project_details",$field_list,$_SESSION['project_id']);
 
update("tbl_project",$field_list_2,$_SESSION['project_id']);
 echo 
'<head>'.
   
'<META HTTP-EQUIV="REFRESH" CONTENT="5;URL=display_project_details.php?project_id='.$_SESSION['project_id'].'">'.
   
'Project details updated.</head>';
 die;  
}
//New staff being entered
if(!empty($_POST['project'])){
 
$_SESSION['project_id']=insert("tbl_project",$field_list_2);
echo 
'<html><head>'.
  
'<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=display_project_details.php?project_id='.$_SESSION['project_id'].'">'.
  
'New project added.</body></html>';
die;  
}
//unset($_SESSION['project_id']);
//unset($_SESSION['project']);
if(!isset($_POST['reset'])){
$sql='SELECT * FROM tbl_project LEFT JOIN tbl_project_details ON tbl_project.project_id = tbl_project_details.project_id WHERE tbl_project_details.project_id='.$_SESSION['project_id'];
$row mysql_fetch_assoc(query($sql));
}
$tab=0;
//Starts form
echo '<html><body>'.
  
'<form id="frm1" name="display_project_details" action="display_project_details.php" method=post>'.
  
textbox_list("","hidden","project_id",$_SESSION['project_id'],0,$tab++).
  
'<ol>'
   
'<fieldset class="submit">'.
    
btn_new_save().
   
'</fieldset>'.
   
'<fieldset><legend>Project</legend>'.
    
textbox_list("Project","input","project",$row['project'],45,$tab++).
    
textbox_list("Name","input","project_desc",$row['project_desc'],45,$tab++).
    
textbox_list("AOA","input","aoa",$row['aoa'],45,45,$tab++).
    
textbox_list("Network Number","input","network_number",$row['network_number'],255,$tab++).
   
'</fieldset>'.
   
'<fieldset><legend>Customers</legend>'.
    
dropdown("Site Owner","company","company_id","company","tbl_company",$row['owner'],$tab++).
    
dropdown("Customer","company","company_id","company","tbl_company",$row['customer'],$tab++).
    
dropdown("Consultant","company","company_id","company","tbl_company",$row['consultant'],$tab++).
   
'</fieldset>'.
   
'<fieldset><legend>Shipping</legend>'.
    
dropdown("INCO Term","inco","inco","inco","tbl_list_inco_terms",$row['inco_term'],$tab++).
    
textbox_list("Named Place","input","inco_place",$row['inco_place'],45,$tab++).
    
textbox_list("RDD","input","rdd",$row['rdd'],45,$tab++).
    
textbox_list("Float","input","float",$row['float'],45,$tab++).
    
textbox_list("Transit Time","input","transit_time",$row['transit_time'],45,$tab++).
    
textbox_list("Ship Date","input","ship_date",$row['ship_date'],45,$tab++).
   
'</fieldset>'.
   
'<fieldset><legend>URL Addresses</legend>'.
    
textbox_list("Workflow","input","work_flow",$row['work_flow'],255,$tab++).
    
textbox_list("Documentum","input","documentum",$row['documentum'],255,$tab++).
    
textbox_list("Transfer to Service","input","xfer_service",$row['xfer_service'],255,$tab++).
    
textbox_list("PDIT","input","pdit",$row['pdit'],255,$tab++).
    
textbox_list("Service Request","input","service_request",$row['service_request'],255,$tab++).
   
'</fieldset>'.
   
'<fieldset><legend>Warranty</legend>'.
    
textbox_list("Accepted","input","wt_accept",$row['wt_accept'],45,$tab++).
    
textbox_list("Shipped","input","wt_ship",$row['wt_ship'],45,$tab++).
   
'</fieldset>'.
   
'<fieldset><legend>Document Transmittals</legend>'.
    
textbox_list("CD","input","st_cd",$row['st_cd'],45,$tab++).
    
textbox_list("Courier","input","st_courier",$row['st_courier'],45,$tab++).
    
textbox_list("email","input","st_email",$row['st_email'],45,$tab++).
    
textbox_list("FTP","input","st_ftp",$row['st_ftp'],45,$tab++).
    
textbox_list("Review Period","input","review_period",$row['review_period'],45,$tab++).
    
textbox_list("Submitting Office","input","submit_office",$row['submit_office'],45,$tab++).
    
textbox_list("Document Leveling","input","document_level",$row['document_level'],45,$tab++).
   
'</fieldset>'.
   
'<fieldset><legend>Variation Costing</legend>'.
    
checkbox("Margin Leveling","margin_level",$row['margin_level'],$tab++).
    
textbox_list("Contingency","input","contigency",$row['contigency'],45,$tab++).
    
textbox_list("Finacials","input","financials",$row['financials'],45,$tab++).
   
'</fieldset>'.
  
'</ol>'.
 
  
'</form>'.
   
'</body></html>';  
?>
PHP Code:
function btn_new_save() {
 return  
'<li><button name="submit" type="submit" tabindex="1000">Save</button>'.
   
'    <button name="reset" type="button" onclick="formReset()" tabindex="1001">Reset</button></li>';


Last edited by dgkindy; 08-20-2010 at 10:34 PM..
dgkindy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-20-2010, 10:49 PM Re: reset button
Skilled Talker

Posts: 76
Name: Nick Cousins
Location: Northern Ireland
Trades: 0
How are you going to handle the reset?

According to your code you're calling the JavaScript function
Code:
formReset()
when the reset button is clicked.

Surely the code in this Javascript function is catching when the reset button is clicked?
__________________
Join
Please login or register to view this content. Registration is FREE


Knowledge is power. Never underestimate the power of stupid people in large numbers.

HandCoder is offline
Reply With Quote
View Public Profile Visit HandCoder's homepage!
 
Reply     « Reply to reset button
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.75714 seconds with 12 queries