Help for a solution

Discussion in 'HTML & Website Design' started by mhrlive, Jul 16, 2012.

  1. #1
    Hello guys,
    Please help me on this, I want a code that copy a code from a input text that the user put, and paste it into another fixed text field wombined with a JS code, check out the example:

    User text or code :
    xxxxxxxxxxxxxxx

    After button press action,
    Static text area Result show :

    JS Code
    xxxxxxxxxxxxxxx
    JS Code

    Thanks in advance
     
    Solved! View solution.
    mhrlive, Jul 16, 2012 IP
  2. #2
    Quick and dirty.... lol

    
    <?php 
    if (isset($_POST['s'])){
      $outputcode = $_POST['JSCODE1']."\n";
      $outputcode .= $_POST['USERCODE']."\n";
      $outputcode .= $_POST['JSCODE3']."\n"; ?>
    <html>
    <head>
    <title>Output</title>
    </head>
    <body>
    <textarea><?=$outputcode;?></textarea>
    </body>
    </html>
    <? } else { ?>
    <html>
    <head>
    <title>Output</title>
    </head>
    <body>
    <form method="post" action="">
    <input type="hidden" name="JSCODE1" value="JSCODE" />
    <input type="hidden" name="JSCODE3" value="JSCODE" />
    <textarea name="USERCODE">XXXXXXXXXX</textarea>
    <input type="submit" name="s" value="MERGE CODE" />
    </form>
    </body>
    </html>
    <? } ?>
    
    Code (markup):
     
    workingsmart, Jul 16, 2012 IP
  3. mhrlive

    mhrlive Active Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #3
    Thanks workingsmart :D you are really smart !
     
    mhrlive, Jul 17, 2012 IP
  4. mhrlive

    mhrlive Active Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #4
    When I put a JS code into value="" it merge that code with the page code, I just want to show the result on the text box, can you help me on this
    check the link : http://www.eaglestats.com/test1.php
     
    mhrlive, Jul 17, 2012 IP
  5. mhrlive

    mhrlive Active Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #5
    I found the solution :D , just turn the special characters < > ' " & into their HTML entities &lt; &gt; and so on .
     
    mhrlive, Jul 17, 2012 IP
  6. Bryan Zazz

    Bryan Zazz Peon

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    you don't need to go back to the server for this ... implied by the PHP code which only runs server-side.
    Instead you should use jquery.
    Doing this in jquery "on the client/browser" is a piece of [enter favorite] cake,
    and saves your server a bit of traffic and CPU cycles...
     
    Bryan Zazz, Jul 25, 2012 IP
    mhrlive likes this.