Run SQL query when click on OK button of warning message

Run SQL query when click on OK button of warning message

am 27.07.2008 23:03:59 von Nasreen Laghari

--0-738392644-1217192639=:97404
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi All,  =0AI am printing a java script=A0warning message. On pressing =
OK button, I want to run an sql query. Below is the way I have tried but sq=
l query is running either press OK or Cancel button on warning message or e=
ven refresh the page (F5). Also redirection, when press OK, also not workin=
g.    =0AAm I using the right approach? Could any 1 please help me =
to sort this problem.    =0ARegards,  =0ANasreen    = 0A=
=0A ou sure you want to delete this record!!')  if (answer)  {  =A0=
=3D '$id'";    mysql_query($sqldel) or die(mysql_error());  =A0=
=A0//header("Location: artist.php");    =A0//window.location=3D"htt=
p://www.yahoo.com/"  =A0?>    }  else  {  =A0window=
..location=3D'index.php'   }" value=3D"DELETE">=0A =0A =

--0-738392644-1217192639=:97404
Content-Type: multipart/related; boundary="0-164887539-1217192639=:97404"

--0-164887539-1217192639=:97404
Content-Type: text/html; charset=us-ascii

Hi All,

 

I am printing a java script warning message. On pressing OK button, I want to run an sql query. Below is the way I have tried but sql query is running either press OK or Cancel button on warning message or even refresh the page (F5). Also redirection, when press OK, also not working.

 

 

Am I using the right approach? Could any 1 please help me to sort this problem.

 

 

Regards,

 

Nasreen  

 

 

 

<tr><td>

<input type="button" onClick="var answer = confirm ('Are you sure you want to delete this record!!')
 if (answer)
 {
  <?php
    
   $sqldel = "DELETE FROM artist where aid = '$id'";
   mysql_query($sqldel) or die(mysql_error());
   //header("Location: artist.php"); 
   //window.location="
"
  ?>  
 }
 else
 {
  window.location='index.php'
  }" value="DELETE">

</td></tr>




--0-164887539-1217192639=:97404
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Id: <1217192436999@dclient.mail.yahoo.com>

R0lGODlh9AG8AoAAAPPz//7+/yH5BAAAAAAALAAAAAD0AbwCAAL/hI+py+0P
o5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMKp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K069nduW
ZsWzltmR0iuVjNvSjTFGsrWLbN3g3cL3gZg/rc+ky6aiDNffCM1OvdYHy9yc
9ni/221r853KjlrenPzL+22a3w3gQRPdA64uBr4DkY3g4LTgDe7gDw7hES7h
E07hFW7hF47hGa7hG87hHe7hHw7iIS7iI07iJW7iJ47iKa7iK87iLe7iLw7j
MS7jM07jNW7jN47jOa7jO87jPe7jPw7kQS7kQ07kRW7kR47kSa7kS87kTe7k
Tw7lUS7lU07lVW7lV47lWa7lW87lXe7lXw7mYS7mY07mZW7mZ47maa7ma87m
be7mbw7ncS7nc07ndW7nd47nKFAAADs=

--0-164887539-1217192639=:97404--
--0-738392644-1217192639=:97404--

RE: Run SQL query when click on OK button of warning message

am 27.07.2008 23:47:24 von Emiliano Boragina

------=_NextPart_000_0007_01C8F019.3822C2F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

Why the =93if(answer){=94 is not in the tag
=20

+ =
_
// Emiliano Boragina _

// Dise=F1o & Comunicaci=F3n //////////////////
+ =
_

// emiliano.boragina@gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_


_____ =20

De: Nasreen Laghari [mailto:nasreen_laghari@yahoo.com]=20
Enviado el: domingo, 27 de julio de 2008 18:04
Para: php-db@lists.php.net
Asunto: [!! SPAM] [PHP-DB] Run SQL query when click on OK button of =
warning
message

=20



=20


=20


Hi All,

=20

I am printing a java script warning message. On pressing OK button, I =
want
to run an sql query. Below is the way I have tried but sql query is =
running
either press OK or Cancel button on warning message or even refresh the =
page
(F5). Also redirection, when press OK, also not working.

=20

=20

Am I using the right approach? Could any 1 please help me to sort this
problem.

=20

=20

Regards,

=20

Nasreen =20

=20

=20

=20



you want
to delete this record!!')
if (answer)
{
=20
$sqldel =3D "DELETE FROM artist where aid =3D '$id'";
mysql_query($sqldel) or die(mysql_error());
//header("Location: artist.php");=20
//window.location=3D" http://www.yahoo.com/"
?> =20
}
else
{
window.location=3D'index.php'
}" value=3D"DELETE">




=20

=20

=20


------=_NextPart_000_0007_01C8F019.3822C2F0--

Re: Run SQL query when click on OK button of warning message

am 28.07.2008 00:03:46 von sempsteen

It seems you've a long way to go. Here is what i can say for you.
First of all PHP and JavaScript are two different programming
languages, running in different environments. JavaScript is a
client-side language which your browser interprets it with the page is
loaded. PHP is a server-side language which gets your source code,
interprets it and sends to the browser. There is no any connection
with these two languages. So you cannot write a PHP code and bind it
to a JavaScript code.
You can only make an HTTP request to PHP page by either redirecting or
you can make AJAX requests.
Good luck.

On Sun, Jul 27, 2008 at 10:03 PM, Nasreen Laghari
wrote:
> Hi All,
>
> I am printing a java script warning message. On pressing OK button, I want
> to run an sql query. Below is the way I have tried but sql query is running
> either press OK or Cancel button on warning message or even refresh the page
> (F5). Also redirection, when press OK, also not working.
>
>
> Am I using the right approach? Could any 1 please help me to sort this
> problem.
>
>
> Regards,
>
> Nasreen
>
>
>
>
> > mysql_query($sqldel) or die(mysql_error());
> //header("Location: artist.php");
> //window.location="http://www.yahoo.com/"
> ?>
> }
> else
> {
> window.location='index.php'
> }" value="DELETE">
>
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Run SQL query when click on OK button of warning message

am 28.07.2008 03:35:42 von Micah Gersten

While sempsteen is correct, you can achieve the correct effect in this
simple scenario by checking the return value of the confirm button.




And then check for the submit...
This is prone to a lot of problems though if this is your only security measure.

You might want to check out this library if you want to do this type of thing often and have useful interaction:
http://xajaxproject.org/

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



sempsteen wrote:
> It seems you've a long way to go. Here is what i can say for you.
> First of all PHP and JavaScript are two different programming
> languages, running in different environments. JavaScript is a
> client-side language which your browser interprets it with the page is
> loaded. PHP is a server-side language which gets your source code,
> interprets it and sends to the browser. There is no any connection
> with these two languages. So you cannot write a PHP code and bind it
> to a JavaScript code.
> You can only make an HTTP request to PHP page by either redirecting or
> you can make AJAX requests.
> Good luck.
>
> On Sun, Jul 27, 2008 at 10:03 PM, Nasreen Laghari
> wrote:
>
>> Hi All,
>>
>> I am printing a java script warning message. On pressing OK button, I want
>> to run an sql query. Below is the way I have tried but sql query is running
>> either press OK or Cancel button on warning message or even refresh the page
>> (F5). Also redirection, when press OK, also not working.
>>
>>
>> Am I using the right approach? Could any 1 please help me to sort this
>> problem.
>>
>>
>> Regards,
>>
>> Nasreen
>>
>>
>>
>>
>> >> mysql_query($sqldel) or die(mysql_error());
>> //header("Location: artist.php");
>> //window.location="http://www.yahoo.com/"
>> ?>
>> }
>> else
>> {
>> window.location='index.php'
>> }" value="DELETE">
>>
>>
>>
>
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php