i have the folowing code

    $datumeind = date("Y-m-d");// current date

    $datumverleden = strtotime(date("Y-m-d", strtotime($datumeind)) . " -99 year");//current date -99 years

    $datumbegin = date('Y-m-d', $datumverleden);


        if($geboorte_datum <= $datumbegin && $inleven_dood == 'In leven' ){
    <script type="text/javascript">
    var r=confirm("Klik ok als In Leven."); 
    if (r==true)
    ("<?php $inleven_dood = 'In leven'; ?> ")

    ("<?php $inleven_dood = 'Overleden';     }?> ")
    // -->


            $updatequery = "UPDATE stamboom_dohmen SET inleven_dood='$inleven_dood' WHERE id='$idpersoon'";
            mysql_query($updatequery) or die (mysql_error()); 

    <form action="gegevens_persoon_bewerken.php" method="post" name="myform" enctype="multipart/form-data">

    <div><input type='checkbox' name='overleden' id='overleden' value='Overleden' title='Kies als overleden.'></div>
    <input type="submit" style=" width:100px;"  name="zenden" value="Alles verzenden"/>

The code

("<?php $inleven_dood = 'In leven'; ?> ")

        ("<?php $inleven_dood = 'Overleden';     }?> ")

between the javascript dosn't work and i don't know wy
The allert box appears
can someone help me to fix it.
Thanks in advice John
Thanks in advice

Recommended Answers

All 2 Replies

It doesn't work because JavaScript is executed on the client side, and PHP is executed on the server side.

You could try using a normal form to post the confirmation back to the server, of if you want it to function asynchronously, you could use AJAX.

If using AJAX, I'd recommend you consider using a JavaScript framework, e.g. jQuery, to handle the heavy lifting.

You can remove double quotes (") before & after php tag.

Be a part of the DaniWeb community

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