Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

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

    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);
    ?>

  • #2
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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>

  • #3
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,341
    Thanks
    13
    Thanked 349 Times in 345 Posts
    there is a comma after the last array element.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #4
    Regular Coder
    Join Date
    May 2009
    Posts
    425
    Thanks
    3
    Thanked 62 Times in 61 Posts
    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:
    PHP Code:
    $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>'

    PHP Code:
    $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:
    PHP Code:
    $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.
    Last edited by tfburges; 12-26-2010 at 06:00 PM.

  • Users who have thanked tfburges for this post:

    calm (12-29-2010)

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by Dormilich View Post
    there is a comma after the last array element.
    That's actually valid in PHP.

  • #6
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tfburges View Post
    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:
    PHP Code:
    $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>'

    PHP Code:
    $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:
    PHP Code:
    $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.

  • #7
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tfburges View Post
    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:
    PHP Code:
    $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>'

    PHP Code:
    $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:
    PHP Code:
    $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>';


  •  

    Posting Permissions

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