Simple PHP Help

Kishsheyroxz

Member
Jan 14, 2008
415
3
0
Fire Nation Capital
Guys i need little help
all i want to do is to export a value in a textarea into a java script

This is the form

Code:
<form action="ytsubmit.php" method="post">
<input name="vid" type="text" id="vid" value="" size="30" />
<input type="submit" name="submit" id="submit" value="Submit" />

This is where i want the value to be in
Code:
var obj = {
          embed  : 'http://www.youtube.com/v/[B]HERE[/B]',
          link      : 'http://www.youtube.com/watch?v=[B]HERE[/B]',
          thumb  : 'http://img.youtube.com/vi/[B]HERE[/B]/default.jpg',
           };
can anybody help
Fast as possible please:oo:
 

sanoka

Well-known member
  • Dec 6, 2007
    5,147
    1,233
    113
    <html>
    <head>

    <script type=text/javascript>

    var x=document.form1.txt.value;
    alert(x);
    </script>

    </head>
    <body>
    <form name=form1>
    <input type=text name=txt>
    </form>
    </body>
    </html>
    hope this is
     

    chintha4u

    Well-known member
  • Mar 27, 2007
    2,601
    39
    48
    x = $_POST['vid'];

    var obj = {
    embed : 'http://www.youtube.com/v/<?php echo x; ?>',
    link : 'http://www.youtube.com/watch?v=<?php echo x; ?>',
    thumb : 'http://img.youtube.com/vi/<?php echo x; ?>/default.jpg',
    };



    Simple as that
     
    • Like
    Reactions: Kishsheyroxz

    tharindudoo

    Well-known member
  • Mar 12, 2007
    10,906
    761
    113
    ..ජනේලේ ගාව....
    x = $_POST['vid'];

    var obj = {
    embed : 'http://www.youtube.com/v/<?php echo x; ?>',
    link : 'http://www.youtube.com/watch?v=<?php echo x; ?>',
    thumb : 'http://img.youtube.com/vi/<?php echo x; ?>/default.jpg',
    };



    Simple as that

    meka hari,form eken post method eka dila,
    php script ekak dapan $_POST['name'].eetapasse eka variable ekakata assign karala.
    ubata one thana variable eka use karapan echo 1k dala