Jump to content

Dealing with Forms


cuboidgraphix

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.