cuboidgraphix Posted December 11, 2007 Share Posted December 11, 2007 Hi guys, I'd like some help with one of my scripts... this is the simplified version... (out of many that still don't work.) Firstly I have to mention that I am working with JPGraph and PHP.... OK.. now, I want to create 1 page. Whereby when the page is loaded, an image with ALL the values are generated out of the database (oh I'm working with a database too) when the DATE RANGE fields are empty. After the date range has been filled, I'd like to generate that image to replace the first image. Following is my code... <!-- Form Start --> <form name="form" method="get" action="<?=$PHP_SELF?>"> From: <input type="text" name="from" value=" " size="8" maxlength="10" onfocus="showCalendarControl(this);"> To: <input type="text" name="to" value=" " size="8" maxlength="10" onfocus="showCalendarControl(this);"> <input type="submit" name="search" value="Search"> </form> <!-- Form Script Start --> <?php $start_date = @$_GET['from']; // combination of start variables $end_date = @$_GET['to']; // combination of end variables if($start_date == "" && $end_date == "") { echo "<p>Please enter a date range!</p>"; echo "<img src=\"graph_heartbeat_all.php\">"; } elseif($start_date == " ") { echo "<p>Please enter a start date ...</p>"; } elseif($end_date == " ") { echo "<p>Please enter an end date ...</p>"; } else { echo "<p>Your request yields the following:</p>"; echo "<img src=\"graph_heartbeat.php\">"; } ?> The action is php_self. Now my problem I know is the action to where it has to be "graph_heartbeat.php" in order for the other graph to be generated. Is there any way that when the ELSE option kicks in, it grabs and sends the values to graph_heartbeat.php without replacing my whole page with just the image? Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 11, 2007 Share Posted December 11, 2007 If you want to load the image dynamically without reloading the page; you need to look into AJAX. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.