Okay, I have been stuck for a few days on this...Have been trying to find an answer on how to pass my variable into the url of the php code and update the url each time the form is submitted. However, all I van find is how to pass the variable through a url...Not really been able to implement this as I feel I need a different solution. So here is the code, everything does seem to be working except for the passing of my $var into the URL and reupdating the script to run with the new URL.
For example the original currently looks like this:
$html = file_get_html('http://www.championselect.net/champ/{$var}');
I want someone to enter a entry into the form and for the $var to update each time.
So: Say someone wants to search for "ziggs" or "jinx", they would enter the name into the form and the form will need to update the script to run the parser with the new $var.
Much appreciated to all help!!
<form action="test.php" method="post">
<input type="text" value="<?php echo $var?>" name="var" />
<input type="submit" value="Send" />
</form>
<?php
$var = $_POST['var'];
echo $var;
// Include the library to use it.
include_once('simple_html_dom.php');
// Get div from site. ... Need to implement user selected queries.
$html = file_get_html('http://www.championselect.net/champ/{$var}');
// Put all of the <a> tags into an array named $result
$result = $html -> find('h2,img[class=CS_Champ_Image],.counterName' );
// Run through the array using a foreach loop and print each link out using echo
foreach($result as $element) {
echo $element." ";}
?>