I'm completely up against a wall with this. I've been trying to learn PHP from tutorials to output two form inputs to my function to generate an image.
I've fixed an issue with my mixing up POST and GET but now my script doesn't function at all and I cant understand why - I'm sure this is hilds play for any developer but I'm in a bit over my head.
This is my app.php
<?php
if (isset($_POST['submit'])) {
$data = $_POST['name']; // the data from text input.
$colour = $_POST['colour']; // data from colour radio.
}
?>
...
<form action="/app.php" method="post">
<input type="text" name="name"/>
<input name="colour" type="radio" value="1">Red<br>
<input name="colour" type="radio" value="2">Blue<br>
<input name="colour" type="radio" value="3">Green<br>
<input type="submit" name="submit" value="Submit">
</form>
<img src="pngfile.php?data=<?php print $data;?>" alt="">
Calls pngfile.php
<?php
require_once 'functions.php'; // Requires and includes do not need brackets.
$textdata = $_POST['data'];
$colourdata = $_POST['colour'];
process($textdata,$colourdata);
exit;
?>
Which in turn calls functions.php
<?php
/* Generate Image */
function process($textdata, $colourdata)
{
...
All of this was working perfectly before but the only change I have added is updating all elements to use POST and also adding in the code across the three files to add the selected colour to post. However with this tweaked code, I get no image output, even though I know my main image function works fine, so it must be my app.php and pngfile.php at fault.
Can anyone please give me some guidance on where I am going wrong?