Good day to everyone!

I just want anybody to correct my code. The code tells that when i click on the button it will dispay a msg that will confirm if the client really wants to add the information, If yes then he will be redirected to another page, if no then the page that contain the onclink confirm will retain to its current status.

Here is my code pls help:

<input name="" type="submit" OnClick=\&quot;return confirm('Are you sure to submit this payment transaction.?);\&quot;" value="Submit Payment" >

When the client click yes.he/she will will redirected to another page.If no, then the current page will retain its current position.

Pls help.!

you can use function like this

<script type="text/javascript">
goOnConfirm(message, href) {
if (confirm(message)) document.location.href = href;
}
</script>

you can use function like this

<script type="text/javascript">
goOnConfirm(message, href) {
if (confirm(message)) document.location.href = href;
}
</script>

thank you sir.!

but how can i bind that function on the onclick event.?should i change something on the function.?

Thank you sir

just put goOnConfirm in onClick with right parameters ;)

thank you sir.!

but how can i bind that function on the onclick event.?should i change something on the function.?

Thank you sir

Sir here is the code ive generate but theres someting wrong on the onclick event ive insetred. Pls check

goOnConfirm(message, href) {
if (confirm(message)) document.location.href = href;
}

this is on the onclick event:

<input name="" type="submit" onClick="goOnConfirm('Are you sure to submit this payment transaction.?' , '<a href="bpipaymentover.php">');" value="Submit Payment" >

but the button goes error". I dont know whats the missing character. pls help

Good day to everyone!

I just want anybody to correct my code. The code tells that when i click on the button it will dispay a msg that will confirm if the client really wants to add the information, If yes then he will be redirected to another page, if no then the page that contain the onclink confirm will retain to its current status.

Here is my code pls help:

<input name="" type="submit" OnClick=\&quot;return confirm('Are you sure to submit this payment transaction.?);\&quot;" value="Submit Payment" >

When the client click yes.he/she will will redirected to another page.If no, then the current page will retain its current position.

Pls help.!

Yes
that is what happens, you can test it if you want
make a file success.html with a message 'success' in it
and a test file

<form action='success.html'>
<input type='submit' onclick="return confirm('are you sure');">
</form>

You dont need any other BS functions or the overhead they add

commented: Very helpful.Great solution +1

i would use the onsubmit attribute in the form tag for this.

<form action="something.html" method="post" onsubmit="return confirm('Are you sure?')">
  <input type="submit" name="submit" value="Submit" />
</form>
commented: Very helpful. Expert solution! +1

thank you so so so muach everyone. the problem has now been solved. I just remove the javascript function and replaced with it the onsubmit of the form event.

This problem was solved. Anyway im always willing to help as far as i know it especially vb6 ans asp, aspx

Thank you ang May have peace on this earth

Onclick in PHP then go to a function... take a look, this script works for me.
:-)

<?php
echo '<form name="forma" method="post" action="member_notificaciones.php">';
echo '<label>';
?>
   <!-- cuadro de dialogo para aceptar eliminación de inscripción -->
   <input type="submit" name="no_ins" value="eliminar" onclick="return confirm('Estas seguro que deseas desinscribirte?');" />
 
<?php
echo '<input name="campana" type ="hidden" value="'.$show[idCampana].'" >';
echo '      </label>';
echo '      </form>';
 
if($_POST['no_ins'])
{
      $eliminar=mysql_query("delete from usuario_inscrito where idUsuario='$valid_user' and idCampana='$campana' and confirmado='si'");
 
      if (!$eliminar) 
        {
            die('Invalid query: ' . mysql_error());
        }
        echo "<META HTTP-EQUIV='refresh' CONTENT='0; URL=$PHP_SELF'>";
}
?>

Best Regards,
Iván Carrasco Q.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.