PatrickAdrichem
asked on
JavaScript and PHP Onclick ask for information (prompt) and process
Alright i have this list of e-mail adresses and this button to change them,
usually i load a new page using the id of the adress and fill in the information and have them use
a form to edit the adress etc.
In this case, i only want to edit the adres, nothing else, just 1 box. So i was hoping i could do it with javascript.
something like:
<a href='javascript:onClick=w indow.prom pt("New e-mail adres:", "<?php echo($row[1]); ?>")'>edit</a>
Only now i have to get it to forward the information to "adresses.php?id=<?php echo($row[0]); ?>"
Is this even possible with this simple javascript?
usually i load a new page using the id of the adress and fill in the information and have them use
a form to edit the adress etc.
In this case, i only want to edit the adres, nothing else, just 1 box. So i was hoping i could do it with javascript.
something like:
<a href='javascript:onClick=w
Only now i have to get it to forward the information to "adresses.php?id=<?php echo($row[0]); ?>"
Is this even possible with this simple javascript?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've done this:
<head>
<script type="text/javaScript">
function change_adress(adres_id, old_adres) {
alert("boo");
advAJAX.get({
url: "adressen_more.php",
parameters : {
"var1" : adres_id,
"var2" : window.prompt("Nieuw email adres:", old_adres)
},
onSuccess : function(obj) { alert(obj.responseText); },
onError : function(obj) { alert("Error: " + obj.status); },
});
}
</script>
</head>
<body>
<td width=300><center><font style='font-family: verdana; font-size: 9pt; color: black;'><a class='menu' href="javascript:onclick(c hange_adre s('<?php echo($row[0]); ?>','<?php echo($row[1]); ?>'))">wijzig</a></font></ center></t d>
</body>
but it doesn't work
<head>
<script type="text/javaScript">
function change_adress(adres_id, old_adres) {
alert("boo");
advAJAX.get({
url: "adressen_more.php",
parameters : {
"var1" : adres_id,
"var2" : window.prompt("Nieuw email adres:", old_adres)
},
onSuccess : function(obj) { alert(obj.responseText); },
onError : function(obj) { alert("Error: " + obj.status); },
});
}
</script>
</head>
<body>
<td width=300><center><font style='font-family: verdana; font-size: 9pt; color: black;'><a class='menu' href="javascript:onclick(c
</body>
but it doesn't work
ASKER
also tried href="#" onclick="change_adres('<?p hp echo($row[0]); ?>','<?php echo($row[1]); ?>')"
which does not give any errors on the page eather, but the click does nothing! =S
which does not give any errors on the page eather, but the click does nothing! =S
ASKER
Never mind i fixed it myself like this:
function change_adres(ourid,email) {
document.hiddenform.idfiel d.value = ourid;
document.hiddenform.mailfi eld.value = window.prompt("Nieuw e-mail adres:", email);
document.hiddenform.submit ();
}
function change_adres(ourid,email) {
document.hiddenform.idfiel
document.hiddenform.mailfi
document.hiddenform.submit
}
I'm glad I could help ;-)
ASKER