0

So, i have to put this <iframe width="560" height="315" src="https://www.youtube.com/embed/qMSxYtrZS-c" frameborder="0" allowfullscreen></iframe> into header.php line 305 as shows like this:

<div id="videoid">
  in this line i have to put that iframe
</div>

then save it, then it shows in front end, to do that, i made custom backend menu in functions.php that show simple form, and it's done:

<form name="kotak" id="lebar" action="" method="get">
 Put the video URL here<br>
<input id="subject" style="width: 800px;"type="text" name="firstname" value=""><br>
<input type="submit" value="Submit">
</form>

now i have to get the value from the form, then shows in that line 305, then save it, then it success, im using this code to call that value in different file and folders, i know there is something missing, and surely not working.

<?php echo $_GET['subject']; ?>

Please tell me what to do to get it success, im trying to write my custom function, not using any plugin. best regards.

1 Answer 1

0

you must put name of input in your $_GET[].

<?php echo $_GET['firstname']; ?>

and also i think you must try $_POST[]

<?php echo $_POST['firstname']; ?>

4
  • change your method to post and try the scond one but i tryed first one and its was ok and worked. have fun.
    – Sajjad Sky
    Commented Aug 11, 2017 at 11:05
  • i change it to <?php echo $_GET['firstname']; ?> , then i add in action="header.php" , it goes 404, i change action="/header.php" it goes The requested URL /header.php was not found on this server. what is i'am missing? i try to google, i find that you have to use Advanced REST Client for Chrome ? because im using HTTP POST through localhost.
    – mas bro
    Commented Aug 11, 2017 at 12:29
  • omg ! cleane the method and still u can get the value ! <form name="kotak" id="lebar"> Put the video URL here<br> <input id="subject" style="width: 800px;"type="text" name="firstname" value=""><br> <input type="submit" value="Submit"> </form> after you use it for getting input value use this : if (isset( $_POST['firstname'] )) { echo $_POST['firstname']; } its sample.
    – Sajjad Sky
    Commented Aug 12, 2017 at 19:41
  • it does not work, <form name="formvideo" action="" method="post"> URL video<br> <input name="subject" type="text" id="subject" style="width: 800px;" value=""> <br> <input type="submit" value="Submit"> </form><br> <?php if (isset($_POST["submit"])){ $video = $_POST['subject']; if ($video == true){ echo "success"; } else { echo "fail"; } } this is the caller: <?php if (isset( $_POST['subject'])) { echo $_POST['subject']; } ?>
    – mas bro
    Commented Aug 13, 2017 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.