Results 1 to 9 of 9

Thread: multiple forms working together?

Threaded View

  1. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2009
    Posts
    156

    Re: multiple forms working together?

    HTML Code:
    <!-- standard html jump menu -->
    <script type="text/JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>
    PHP Code:
    // get all values from URL (form set to get)

    if(isset($_GET['planttype'])){$planttypeget $_GET['planttype'];}
    if(isset(
    $_GET['plantname'])){$plantnameget $_GET['plantname'];}
    if(isset(
    $_GET['description'])){$plantdescriptionget $_GET['description'];}
    if(isset(
    $_GET['costnumber'])){$costnumber $_GET['costnumber'];}
    if(isset(
    $_GET['planttype'])){$rownumbers count($_GET['planttype'])+2;}else{$rownumbers 2;} 
    !standard conect to database & query!
    HTML Code:
    <form method="get">
    <table width="100&#37;" border="1" cellspacing="1" cellpadding="1">
            <tr>
              <td width="75" align="center">Item</td>
              <td width="75" align="center">No.</td>
              <td align="center">Description</td>
              <td width="75" align="center">Total</td>
              <td width="75" align="center"></td>
    		  <!--calculating amount of rows to place in -->
            </tr><?php $rowcounter=0; while($rownumbers > $rowcounter){if($rowcounter > 0&&$deleterow['X']!=$rowcounter){?>
            <tr>
              <td align="center">&nbsp;</td>
              <td align="center"><input type="text" name="itemcodes[<?php echo $rowcounter; ?>]" class="boxsquare" value="<?php echo $itemcodes[$rowcounter]; ?>"/></td>
              <td><?php $planttype=$_GET['planttype']; if(!$planttype[$rowcounter]){ ?>
    		  <!-- selecting plant type tree/shrub/misc -->
    		  <select name="selectType" class="box" onchange="MM_jumpMenu('parent',this,0)">
                <option value="">Type</option>
    			<?php 
    			while($plant_type = mysql_fetch_array($find_type)){ ?>
                <option value="?<?PHP echo $URL_1.$URL_2.$URL_3.$URL_4."&planttype[".$rowcounter."]=".$plant_type['treeShrub']; ?>"><?php echo $plant_type['treeShrub']; ?></option>
    			<?php $typeno++;} ?>
              </select><?php } ?>
    		  
    		  <?php $plantname=$_GET['plantname'];if($planttype[$rowcounter]&&!$plantname[$rowcounter]){ ?>
    		  <!-- ########## select plant name apple/pear/turnip ######### -->
    		  <select name="selectPlant" class="box" onchange="MM_jumpMenu('parent',this,0)">
                <option value="">Name</option>
    			<?php 
    			$find_plant = mysql_query("SELECT * FROM $user[WorkS] WHERE treeShrub='$planttype[$rowcounter]' GROUP BY plant ");
    			while($plant_name = mysql_fetch_array($find_plant)){ ?>
                <option value="?<?PHP echo $URL_1.$URL_2.$URL_3.$URL_4."&plantname[".$rowcounter."]=".$plant_name['plant']; ?>"><?php echo $plant_name['plant']; ?></option>
    			<?php } ?>
              </select><?php } $plantdescription=$_GET['description'];if(!$plantdescription[$rowcounter]){echo $plantname[$rowcounter]." - ";}  ?>
    		  
    		  <?php if($plantname[$rowcounter]&&!$plantdescription[$rowcounter]){ ?>
    		  <!-- ########## select work description plant/remove/reduce ########## -->
    		  <select name="selectDescription" class="box" onchange="MM_jumpMenu('parent',this,0)">
                <option value="">Description</option>
    			<?php 
    		  $find_description = mysql_query("SELECT * FROM $user[WorkS] WHERE plant='$plantname[$rowcounter]' GROUP BY type");              // plant description listing
    			while($plant_description = mysql_fetch_array($find_description)){ ?>
                <option value="?<?PHP echo $URL_1.$URL_2.$URL_3.$URL_4."&description[".$rowcounter."]=".$plant_description['type']; ?>"><?php echo $plant_description['type']; ?></option>
    			<?php } ?>
              </select>
    		  <?php } $descriptionmod=$_GET['newdescription']; if($plantdescription[$rowcounter]){?>
    		  <!-- ########## display selection results ########## -->
    		  <textarea name="newdescription[<?php echo $rowcounter; ?>]" cols="60" rows="3"  ><?php 
    		  if($descriptionmod[$rowcounter]!="") echo "$descriptionmod[$rowcounter]"; 
    		  else echo "$plantname[$rowcounter] - $plantdescription[$rowcounter]"; 
    		  ?></textarea>
    <br/>
    		  
    		  
    		  <input type="submit" name="adddescription[<?php echo $rowcounter; ?>]" class="boxsmall" value="add description"/>
    		  <input type="submit" name="updatedescription[<?php echo $rowcounter; ?>]" class="boxsmall" value="update description" /><?php } ?>
    		  
    		  
    		  
    		  
    		  </td>
              <td align="center">
    		  <!-- ########## place a number to calculate total cost ########## -->
    		  <input type="text" name="costnumber[<?php echo $rowcounter; ?>]" class="boxsquare" value="<?php echo $costnumber[$rowcounter]; ?>"/></td>
              <td align="center">
    		  <!-- ########## remove a row button ########## -->
    		  <input type="submit" name="itemnumber[<?php echo $rowcounter; ?>]" value="X" class="boxsquare"  /></td>
            </tr><?php }$rowcounter++;} ?>
            <tr>
              <td align="center">&nbsp;</td>
              <td align="center">&nbsp;</td>
              <td align="center">&nbsp;</td>
              <td align="center"><!-- total placed here ?!--></td>
              <td align="center">&nbsp;</td>
            </tr>
          </table>
    <form>
    I have lots of PHP and would like to implement your awsome code for numbers in the total column (where costnumber[] is) but no matter how I try to change or adapt it, it won't work!?

    Please help

    Thanks

    +if you know how I can submit my form when using a jump menu so values entered into the fields total / No. are passed on and recorded!?
    Last edited by LingoOutsider; Aug 11th, 2009 at 09:16 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width