...

View Full Version : How may I insert html into $lang = array_merge (PHP)



calm
12-26-2010, 10:37 AM
here is the original PHP code below, much appreciated in advance

How may I insert html into $lang = array_merge (PHP)



<?php
$lang_ext = array(
'onlinepay' => 'Online payment',
'oid' => 'Order Number:',
'pname' => Name:',
'onums' => 'Number:',
'oprices' => 'price:',
'mons' => 'money:',
'rcode' => 'Verification Code:',
'payit' => 'Pay Now',
'npayfor' => 'Price to be paid',
'paym' => 'Do you confirm payment now? ',
'payerror' => 'Please transfer money to your account first, thank you. ',
'fcharge' => 'Please deposit money here ',
);
$lang = array_merge($lang, $lang_ext);
?>

calm
12-26-2010, 10:38 AM
How may I insert HTML codes below into the PHP codes above? Thanks a lot

<form method="post" action="www.123648.com/apple" >
<input type="hidden" name="ap_productid" value="mango=="/>
<input type="hidden" name="ap_quantity" value="1"/>
<input type="image" name="ap_image" src="https://www.123648.com/B26C4898CBBE2DD8b0en.gif"/>
</form>

<a href='https://123648.com/applet?CTd5422ZwM='>Mango</a>

Dormilich
12-26-2010, 04:45 PM
there is a comma after the last array element. ;)

tfburges
12-26-2010, 05:56 PM
What exactly do you mean by "insert html into php codes"?

You just want to store the html as a variable in the $lang array?

If so... something like:

$lang['form'] = '<form method="post" action="www.123648.com/apple" >
<input type="hidden" name="ap_productid" value="mango=="/>
<input type="hidden" name="ap_quantity" value="1"/>
<input type="image" name="ap_image" src="https://www.123648.com/B26C4898CBBE2DD8b0en.gif"/>
</form>';


$lang['link'] = '<a href="https://123648.com/applet?CTd5422ZwM=">Mango</a>';

And if you need to keep single quotes, you'll need to add backslashes before them:

$lang['link'] = '<a href=\'https://123648.com/applet?CTd5422ZwM=\'>Mango</a>';
But it's generally good practice to use double quotes for the html elements' attributes.

Inigoesdr
12-26-2010, 10:26 PM
there is a comma after the last array element. ;)

That's actually valid in PHP. ;)

calm
12-29-2010, 04:48 AM
What exactly do you mean by "insert html into php codes"?

You just want to store the html as a variable in the $lang array?

If so... something like:

$lang['form'] = '<form method="post" action="www.123648.com/apple" >
<input type="hidden" name="ap_productid" value="mango=="/>
<input type="hidden" name="ap_quantity" value="1"/>
<input type="image" name="ap_image" src="https://www.123648.com/B26C4898CBBE2DD8b0en.gif"/>
</form>';


$lang['link'] = '<a href="https://123648.com/applet?CTd5422ZwM=">Mango</a>';

And if you need to keep single quotes, you'll need to add backslashes before them:

$lang['link'] = '<a href=\'https://123648.com/applet?CTd5422ZwM=\'>Mango</a>';
But it's generally good practice to use double quotes for the html elements' attributes.

I am Sorry first since I miss your reply.

Secondly, thank you very much, i will try again.

calm
12-29-2010, 01:31 PM
What exactly do you mean by "insert html into php codes"?

You just want to store the html as a variable in the $lang array?

If so... something like:

$lang['form'] = '<form method="post" action="www.123648.com/apple" >
<input type="hidden" name="ap_productid" value="mango=="/>
<input type="hidden" name="ap_quantity" value="1"/>
<input type="image" name="ap_image" src="https://www.123648.com/B26C4898CBBE2DD8b0en.gif"/>
</form>';


$lang['link'] = '<a href="https://123648.com/applet?CTd5422ZwM=">Mango</a>';

And if you need to keep single quotes, you'll need to add backslashes before them:

$lang['link'] = '<a href=\'https://123648.com/applet?CTd5422ZwM=\'>Mango</a>';
But it's generally good practice to use double quotes for the html elements' attributes.

I have edited again with code below, there is no error but it is not showing related items. however, thanks a lot for your help! ^~^

$lang['form'] = '<form method="post" action="www.123648.com/apple" >
<input type="hidden" name="ap_productid" value="mango=="/>
<input type="hidden" name="ap_quantity" value="1"/>
<input type="image" name="ap_image" src="https://www.123648.com/B26C4898CBBE2DD8b0en.gif"/>
</form>';



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum