Jump to content

[SOLVED] Re-use Code


ainoy31

Recommended Posts

Hello-

 

I have a form with 4 radio buttons where people can choose what they want to do.  Base on what they select, I display the questions.  The 4 options uses almost the same questions except 2 or 3 here and there.  I decided to put the questions in a separate function.  Once an option has been picked, the question function gets called.  Here is the code that does this:

<input type="radio" name="shipment_type" value="air" onClick="hideAll(); changeDiv('air', 'block'); ">AIR

<input type="radio" name="shipment_type" value="lcl" onClick="hideAll(); changeDiv('lcl', 'block'); ">LCL

<input type="radio" name="shipment_type" value="fcl" onClick="hideAll(); changeDiv('fcl', 'block'); ">FCL

<input type="radio" name="shipment_type" value="truck" onClick="hideAll(); changeDiv('truck', 'block'); ">TRUCK

 

<div id="lcl" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

<div id="lcl" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

<div id="fcl" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

<div id="truck" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

It does displays the questions for each options picked but the problem is that none of the calculation fields work.  Now, if I remove the echo cal_dim() away except for one option, then it works.  Seems like I can not  have all the options calling cal_dim() at the same time.  Can my javascript cause this issue?  All of my calculation fields uses javascript.  I hope this is clear enough to understand.  Much appreciation.  AM

Link to comment
https://forums.phpfreaks.com/topic/80304-solved-re-use-code/
Share on other sites

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.