I'm having trouble setting a HTML input text into a PHP variable $x
. If I set $x
to an image URL, my code seems to work. Now I want the user to input an URL instead of myself. I've tried using [value = "<?$x ?> ]
and other variations of this inside of the input text tag but they didn't work. I've also tried using $image_source
(my input name) inside of my PHP tags, but I just get errors instead.
I do not have a submit button because it refreshes my page, negating the PHP echo, so I changed it to a button. How can I put the user's input into a variable so that I can use it inside of my php tags?
<body>
<form action = "metadata.php" method = "post" id = "meta_form">
<input type = "text" name = "image_source" id = "image_source" />
<input type = "button" value = "Check" id ="submit_button" onclick = "check();"/>
</form>
<?php
$photo_data = exif_read_data($x);
echo $photo_data['FileName'];
?>
</body>