Trying to find a solution any help or pointers to get me in the right direction would be appreciated.
Scenario: I have a HTML form that I use to modify a mysql database with PHP. I want when the page loads it has a field on this form that pulls from the database which is easy enough with
<input type="text" name="inputTag" value="<?php echo $people['Service Tag']; ?>" onblur="this.value=this.value.toUpperCase()" />
That would be to easy. I have a separate php page say... test.php that scrapes text off of a page and stores in a variable. With something similar to this
<?php $file_string = file_get_contents('http://blahblah.com/'); preg_match("/<title>Product Support for (.+)\| HP/i", $file_string, $matches); $print = "$matches"; ?>
I need something that will allow me to populate the form field with the php variable $print from the test.php and put that into the value of the inputTag field only if the field is clicked
Basically I dont want it to run the file_get_contents everytime my page loads because it is slow and not always needed. But I want the form field to display what is currently stored in the database onload but allow you to click that form field which triggers the screen scrape php file and echos the $print variable from that php file in the text field of the form so that I can then submit the form after im finished filling it out.
I am kind of a noob when it comes to this stuff but can get around some... Best I could figure out is that I need to make a AJAX call with something like this.
Is this even possible or am I living in a dreamland? sorry if this is confusing I can try to clarify if needed.
UPDATE* Update Field
this is what I finally used to to get it to work thanks