RE: [PHP] could i get a clue?
| From: | Robert V. Zwink | Date: | Wed, 15 Aug 2001 13:44:58 +0000 |
| Subject: | RE: [PHP] could i get a clue? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62821@lists.php.net to get a copy of this message | ||
I don't think this is the "only possible way". I have used an html IMG tag,
then created something like a rollover effect that called a php file for the
image. It was kind of like a stop light, the light was off until focus came
off of a particular form element, javascript then updated the image href
with a few extra arguments, then the light turned green or red.
You can also use a javascript popup window to call a php script. I'm sure
there are a few ways to do this too.
Here's the javascript
<input type="text" size="45" name="1_1_email" value=""
tabindex=1
onChange='validate_email()'><IMG SRC="./trans.gif" NAME=animation width=10
height=10 align=middle>
<SCRIPT>
function validate_email(){
document.animation.src = "./image.phtml?email=" +
document.forms[0].elements[1].value ;
return true;
}
</SCRIPT>
here's the php
<?php
include("get_connected.func");
// This script checks for the existence of an image file, and outputs it,
// if the image is not found than it will output a generic image
$yes_image = "./green.gif";
$no_image = "./red.gif";
header("Content-type: image/gif");
$mysqlconn = new MySQL_class;
$mysqlconn->Create($db);
$select = "SELECT COUNT(item_id) FROM mkt_question_response WHERE item_id =
'".$HTTP_GET_VARS["email"]."' GROUP BY item_id";
$mysqlconn->Query($select);
if($mysqlconn->rows > 0){
readfile($no_image);
}else{
readfile($yes_image);
}
?>
Robert Zwink
http://www.zwink.net/daid.php
-----Original Message-----
From: Renze Munnik [mailto:renze@datalink.nl]
Sent: Tuesday, August 14, 2001 11:30 AM
To: marilyn manson; php-general@lists.php.net
Subject: Re: [PHP] could i get a clue?
On Tue, Aug 14, 2001 at 10:18:18AM -0500, marilyn manson wrote:
> ok a basic question. perhaps I dont know enough about javascript but
> anyway..
>
> I want to call a php script from javascript. Anybody have any hints for
me?
> A link to a useful website would work as well. thanks mates
>
> -student of computer science
FAIK the only possibility is to redirect to the PHP script. Then
you'll get something like:
window.location.href="myscript.php";
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: renze@datalink.nl
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
-- H: +31 23 5516190
--
-- Stationsplein 82
-- 2011 LM HAARLEM
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net