My question is this:
How do I use a php function with an argument FROM MY php/html form?
I downloaded this php function script from intechgrity.
Link: http://www.intechgrity.com/?p=808
The function is: itg_fetch_image('http://the.image.url/pic.bmp')
What I'm doing:
1) On my website I have a php page.
2) What I did was copy all of the intechgrity php script and pasted it into my page (at the top, of course)
In my page I have this form, but nothing is happening.
<form action="<?php echo $PHP_SELF;?>" method="post">
<input type="text" id="Stuff" name="Stuff" maxlength="30" value="<?=$img_url;?>" />
<button type="button" onClick="newSrc();">Do it!</button>
</form>
What am I doing wrong, how come when I hit submit the function is not working?
Something like this, maybe? (I didn't check through all the code you linked to.)
<?php
function itg_fetch_img($img_url, ...) {
etc.
}
$img_url = $_POST['Stuff'];
if (!empty($img_url)) itg_fetch_img($img_url, ...);
?>
<form action="" method="post">
<input type="text" id="Stuff" name="Stuff" maxlength="30" value="<?=$img_url;?>" />
<input type="submit">Do it!</button>
</form>
Note that button is now an input with type submit, and javascript function is removed.