dropdown box help needed..

Discussion forum for MOD Writers regarding MOD Development.
Locked
baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

dropdown box help needed..

Post by baller1234 » Wed May 28, 2014 2:11 pm

Hi all,

I need some help with some code. Im not a php programmer so help is needed :D.
The code is here:

Code: Select all

$amountoptions = '<select name="amount" >';
$amount_methods = array( 
                         
                         $user->lang['month'],
                         $user->lang['3month'],
                         $user->lang['6month'],
                         $user->lang['12month'],
                         $user->lang['lmonth'],
                         );

foreach($amount_methods as $amountid){ 

$amountoptions .= ('<option value="' . $amountid . '">' . $amountid . '</option>');		
} 
$amountoptions .= '</select>';


$methodoptions = '<select name="payment_method" >';
$payment_methods = array($user->lang['One_time_donation'], 
                         $user->lang['Recurring_one_week'],
                         $user->lang['Recurring_one_month'],
                         $user->lang['Recurring_three_month'],
                         $user->lang['Recurring_six_month'],
                         $user->lang['Recurring_one_year'],
                         );
for($i = 0; $i < count($payment_methods); $i++)
{
	if(strlen(trim($payment_methods[$i])) > 0)
	{
		$methodoptions .= ('<option value="' . $i . '">' . $payment_methods[$i] . '</option>');		
	}
}
$methodoptions .= '</select>';
How can i make it so that when a user chooses a option in the first dropdown the second dropdown is populated and vice verse

the

Code: Select all

$user->lang['month'] 
belongs to

Code: Select all

$user->lang['Recurring_one_month'] 


etc..

the

Code: Select all

$user->lang['One_time_donation']
is a free option and does need any binding with another var

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51726
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: dropdown box help needed..

Post by Brf » Wed May 28, 2014 2:17 pm

I am not sure what your question has to do with PHP.
The user is interacting with an HTML page. If you want two drop-downs on the user's page that interact with one another, the code would have to be some sort of javascript, not PHP. The PHP code is only seen by the webserver, not by the user's webbrowser.

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: dropdown box help needed..

Post by baller1234 » Wed May 28, 2014 2:23 pm

Thanks you for your answer.. It makes sense.. But the template has only this:

Code: Select all

  <table width="100%" cellpadding="0" cellspacing="10" border="0">
  <tr>
  	<td valign="top" align="left">
	<form action="{LW_PAYPAL_ACTION}" method="post">
<div class="panel">

	<div class="inner"><span class="corners-top"><span></span></span>
	<h2>{L_LW_DONATE_EXPLANATION}</h2>	
	<p>{L_LW_DONATE_EXPLANATION_TEXT}</p>
	</div>
	<span class="corners-bottom"><span></span></span></div>
</div>	
<div class="panel">

	<div class="inner"><span class="corners-top"><span></span></span>
	<h2>{L_LW_TOPUP_TITLE}</h2>	
		<fieldset class="fields1">
			<dl>
				<dt>{L_LW_AMOUNT_TO_PAY}</dt>
								<dd>
<dd>{LW_AMOUNT_TO_PAY}<br /></dd>
</dd>
			</dl>
			<dl>
				<dt>{L_LW_CURRENCY_TO_PAY}</dt>
				<dd>{LW_CURRENCY_OPTIONS}</dd>
			</dl>
			<dl>
				<dt>{L_LW_DONATE_METHOD} </dt>
				<dd>{LW_DONATE_METHOD_OPTIONS}<br />{LW_DONATE_METHOD_EXPLAIN}</dd>
			</dl>

		</fieldset>
	</div>
	<span class="corners-bottom"><span></span></span></div>
</div>
<div class="panel">

	<div class="inner"><span class="corners-top"><span></span></span>
		<fieldset class="submit-buttons">
			<input type="submit" name="submit" class="mainoption" value="GO" />
		</fieldset>	
	</div>
	<span class="corners-bottom"><span></span></span></div>
</div>
	</form>
	</td>
  </tr>
  </table>
i use this:

{LW_AMOUNT_TO_PAY}

{LW_DONATE_METHOD_OPTIONS}

and have no idea how to use that in javascript.

Locked

Return to “[3.0.x] MOD Writers Discussion”