I'm wanting to create an hyperlink that will execute a mysql_query and
then refresh the current page if it's clicked on. I've similar things
created via javascript but didn't know if such was possible with PHP.
However, using this technique all the GET-variables would be cleared.
Also, I personally would use two PHP-Files, if you don't need to use the
returned data from the query in the first script:
I'm wanting to create an hyperlink that will execute a mysql_query and
then refresh the current page if it's clicked on. I've similar things
created via javascript but didn't know if such was possible with PHP.
>
On May 20, 3:23 pm, Philipp Grassl <p.gra...@gmx.a twrote:
You could do it like
>
---
<?
>
if (isset($_GET['q']) && $_GET['q']=='y')
{
mysql_query(... );
header("Locatio n: ?");
>
}
>
echo "<a href='?q=y'>Exe cute Query</a>";
>
?>
---
>
However, using this technique all the GET-variables would be cleared.
Also, I personally would use two PHP-Files, if you don't need to use the
returned data from the query in the first script:
The problem is I do need the return data. I guess a good example would
be something similar to a voting poll. If you haven't voted then the
"vote" img will be displayed. Clicking on it will execute a mysql
update. The page will then refresh with the vote results in place of
the vote image.
On May 20, 3:23 pm, Philipp Grassl <p.gra...@gmx.a twrote:
>You could do it like
>>
>---
><?
>>
>if (isset($_GET['q']) && $_GET['q']=='y')
>{
> mysql_query(... );
> header("Locatio n: ?");
>>
>}
>>
>echo "<a href='?q=y'>Exe cute Query</a>";
>>
>?>
>---
>>
>However, using this technique all the GET-variables would be cleared.
>Also, I personally would use two PHP-Files, if you don't need to use the
>returned data from the query in the first script:
>
>
The problem is I do need the return data. I guess a good example would
be something similar to a voting poll. If you haven't voted then the
"vote" img will be displayed. Clicking on it will execute a mysql
update. The page will then refresh with the vote results in place of
the vote image.
>
There are several ways you can do it. For instance, you can store the
$_GET variables in $_SESSION. You can add the variables when building
your "vote" link. You can put them as hidden fields in a form that is
submitted when they click on the link...
All kinds of things you can do. Which way is best is for you to decide.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
On May 21, 12:50 am, Akhenaten <jonko...@gmail .comwrote:
I'm wanting to create an hyperlink that will execute a mysql_query and
then refresh the current page if it's clicked on. I've similar things
created via javascript but didn't know if such was possible with PHP.
These all are long methods take a function for displaying image and
for sucessfull message
On May 21, 12:50 am, Akhenaten <jonko...@gmail .comwrote:
>I'm wanting to create an hyperlink that will execute a mysql_query and
>then refresh the current page if it's clicked on. I've similar things
>created via javascript but didn't know if such was possible with PHP.
>
These all are long methods take a function for displaying image and
for sucessfull message
>
like:
>
if (isset($_GET['q']) && $_GET['q']=='y')
{
mysql_query(... );
display("messag e");
}
else
display();
>
function display($msg){
if(is_empty($ms g){
then logic for displaying image
}else{
logic for displaying the sucessfull message.
}
}
>
make sure all the variables in the function should be global variables.
>
You should not use global variables. If you need a variable in a
function, you should pass it as a parameter.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
Comment