Comment mettre du code php dans une condition javascript ?
Bonjour,
J'ai trouv� un script javascript qui marche bien. J'aimerais lui ajouter mon code php. Dans la condition javascript, j'aimerais ajouter le code php qui inserre la donn�e dans une DDB. Je ne sais pas comment ins�rer mon php dans du javascript.
Voici la chose :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <script type="text/javascript">
function opennewsletter(){
emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'modalfiles/newsletter.htm', 'Newsletter Signup page', 'width=350px,height=200px,center=1,resize=0,scrolling=1')
emailwindow.onclose=function()
{ //Define custom code to run when window is closed
var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
var theemail=this.contentDoc.getElementById("emailfield") //Access form field with id="emailfield" inside iframe
if (theemail.value.indexOf("@")==-1)
{ //crude check for invalid email
alert("Please enter a valid email address")
return false //cancel closing of modal window
}
else{ //Si mail est valide ici faire du php. Je voudrais mettre ici mon php le genre <?php $emailfield = $_GET['emailfield']; etc. ?>
document.getElementById("youremail").innerHTML=theemail.value //Assign the email to a span on the page
return true //allow closing of window
}
}
} //End "opennewsletter" function
</script> |
D'avance je vous remercie beaucoup