Current location: Hot Scripts Forums » Programming Languages » PHP » need help from the experts, please


need help from the experts, please

Reply
  #1 (permalink)  
Old 12-18-03, 04:56 PM
tcooper tcooper is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
need help from the experts, please

Okay I have a couple of select boxes. When the user clicks on the first select box the form is submitted to itself and I retrieve the value of the selection and make my "select" box into a plain textbox with the value that the user selected. Now my second select box is filtered based on the selection of the first select box. This works great. My problem is that I do more of this later in the form and every time I submit the form to itself my first select box changes values. How can I make the value a constant number?

example of what I have is
<?php
$ckSubmit=$HTTP_POST_VARS['ckSubmit']+1;//Here I am declaring variables that occur after the form has been posted
$industry=$HTTP_POST_VARS['selectIndustry'];
$ind=get_ind_string($industry);
$prarea=$HTTP_POST_VARS['selectPrArea'];
$prarea1 = get_prarea_string($prarea);

if ($ckSubmit>4){
$doSubmit='poreport2.php';}
elseif ($ckSubmit<4){
$doSubmit=$_SERVER['PHP_SELF'];}

?>


<html>
<head>
<title>PROJECT OPENING REPORT</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#CCCCCC">
<table width="631" height="143" border="0">
<tr>
<td width="332" height="137"><img src="intranet_01.jpg" name="Image1" width="300" height="50" id="Image1"><img src="intranet_03.jpg" name="Image2" width="300" height="50" id="Image2"></td>
<td width="283"> <div align="center"><strong><font size="5">Project Opening
Report</font></strong></div></td>
</tr>
</table>
<form name="form1" method="POST" action="<?php echo $doSubmit;?>" >

<table width="95%" border="1" align="center">
<tr>
<td colspan="3"><strong>Service Code:
<?php if ($ckSubmit>2) {?>
<input name="txtSelectIndustry" type="text" id="txtSelectIndustry" value="<?php echo $ind;?>">
<?php } else {?>
<select name="selectIndustry" style="width:20%" size="1" id="selectIndustry">
<option value="2">Electric</option>
<option value="4">IT</option>
<option value="6">Natural Gas</option>
<option value="7">Other</option>
<option value="8">Telecom</option>
<option value="9">Wtr &amp; WasteWtr</option>
</select>
<?php }?>
<?php if ($ckSubmit>2) {?>
<input name="txtPrArea" type="text" id="txtPrArea" value="<?php echo $prarea1;?>">
<?php } else {?>
<select name="selectPrArea" id="selectPrArea" style="width:30%" onchange="document.form1.submit()">
<option value="05">Acquisition, Consolidation, Priv &amp; Valuation</option>
<option value="10">Antitrust &amp; Mkt Analysis</option>
<option value="15">Billing, Metering &amp; Data Collection &amp; Processing</option>
<option value="20">Cost of Capital &amp; Regulatory Econ</option>
<option value="25">Cost of Service &amp; Rates</option>
<option value="30">Econometric Forecasting &amp; Statistical Analysis</option>
<option value="35">Education and Training</option>
<option value="40">Financial Forecasting &amp; Analysis</option>
<option value="50">Industry Restructuring &amp; Retail Competition</option>
<option value="70">Resource Planning &amp; Procurement</option>
<option value="75">Software Sales &amp; Support</option>
<option value="80">Strategic Planning &amp; Analysis</option>
<option value="90">Transmission Planning &amp; Analysis</option>
</select>
<?php }?>
</td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Submit" >
</p>
<input type="hidden" name="ckSubmit" value="<?php echo $ckSubmit; ?> ">
</form>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old 12-18-03, 10:32 PM
michaeln michaeln is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
<?php
$ckSubmit=$_POST['ckSubmit']+1;

if(isset($_POST['txtSelectIndustry'])) $industry = $_POST['txtSelectIndustry'];
else $industry=$_POST['selectIndustry'];
$ind=get_ind_string($industry);

if(isset($_POST['txtPrArea'])) $prarea = $_POST['txtPrArea'];
else $prarea=$_POST['selectPrArea'];
$prarea1 = get_prarea_string($prarea);

if ($ckSubmit>4) $doSubmit='poreport2.php';
else $doSubmit=$_SERVER['PHP_SELF'];
?>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Yoo php experts ..help plz Marko PHP 4 08-24-03 11:36 AM
Hey Experts... guide a newbie :) Salvage PHP 7 08-18-03 06:27 PM


All times are GMT -5. The time now is 07:37 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.