Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've created one page video.php in that I need to get the embed code for the video into the text box from the end user and pass the code to one div section. And I've tried,

HTML
<html>
<head>
<title> Welcome </title>
</head>
<body>
<form name="frm" action="#" method="post">
<INPUT TYPE = "Text" NAME = "code">
<input type="submit" value="Enter Code">
</form>
<?php $code1 = $_POST["code"]; ?>
<div class='video-container'>
<center>
<!-- I need the embed code here -->
</center>
</div>
</body>
</html>


But I don't know how to pass the exact value of the text box to the div section. Help me to do this..


Thanks in advance,
Sanjita
Posted

1 solution

Try $_POST["frm"]["code"]

you can then do echo $code1; when you need the code.

A couple things though.
* You should check that the form was submitted and the code was set by checking empty($_POST) and strlen($code1).
* You shouldn't use values sent by the user directly in your code, you should do a filter.
* You should consider using a templating engine, I use Twig[^], it helps with the point above.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900