Lo siento, creo que está haciendo mal. Necesita crear una dirección URL con JavaScript y enviar el usuario allí.
window.location.href = "page.php?x=" + msg;
Luego page.php sería tomar esa variable, lo Desinfecte y hacer la edición de base de datos.
Por ejemplo, en su actual página/pup-up tienes:
<script>
function msg()
{
var message=prompt("Please enter your msg","<? echo $user;?>");
if (msg!=null)
{
window.location.href = "page.php?x=" + msg;
}
}
</script>
- <script>
- function msg()
- {
- var message=prompt("Please enter your msg","<? echo $user;?>");
- if (msg!=null)
- {
- window.location.href = "page.php?x=" + msg;
- }
- }
- </script>
y luego en page.php usted tendría el siguiente código:
<?php
$x1 = "message"; /*this has to be hard set. it works*/
$x2 = sanitize($_GET['x']);
$database->name($user, $x1, $x2);
?>
- <?php
- $x1 = "message"; /*this has to be hard set. it works*/
- $x2 = sanitize($_GET['x']);
- $database->name($user, $x1, $x2);
- ?>
Lo que tienes ahora:
<script>
function msg()
{
var message=prompt("Please enter your msg","<? echo $user;?>");
if (msg!=null)
{
x="" + msg + "";
<? $x1= "message"; /*this has to be hard set. it works*/
$x2= $x ;
$database->name($user, $x1, $x2);?>
}
}
</script>
- <script>
- function msg()
- {
- var message=prompt("Please enter your msg","<? echo $user;?>");
- if (msg!=null)
- {
-
- x="" + msg + "";
- <? $x1= "message"; /*this has to be hard set. it works*/
- $x2= $x ;
- $database->name($user, $x1, $x2);?>
- }
- }
- </script>
1. Para establecer una variable en javascript creo que necesita la palabra var delante del nombre de la variable
var x = msg;2. Intenta utilizar una variable de JavaScript en PHP. PHP no tiene una variable
$x establece, así su justa en blanco (con sorpresa que no está recibiendo un error)
EDITAR:
<script>
function msg()
{
var message=prompt("Please enter your msg","<? echo $user;?>");
if (msg!=null)
{
x="" + msg + "";
[b]<?[/b] $x1= "message"; /*this has to be hard set. it works*/
$x2= $x ;
$database->name($user, $x1, $x2);?>
}
}
</script>
I think you put the starting PHP tags too early... I think you meant to put them here....
<script>
function msg()
{
var message=prompt("Please enter your msg","<? echo $user;?>");
if (msg!=null)
{
[b]<?[/b] x="" + msg + "";
$x1= "message"; /*this has to be hard set. it works*/
$x2= $x ;
$database->name($user, $x1, $x2);?>
}
}
</script>
- <script>
- function msg()
- {
- var message=prompt("Please enter your msg","<? echo $user;?>");
-
- if (msg!=null)
- {
-
- x="" + msg + "";
- [b]<?[/b] $x1= "message"; /*this has to be hard set. it works*/
- $x2= $x ;
- $database->name($user, $x1, $x2);?>
- }
- }
- </script>
-
- I think you put the starting PHP tags too early... I think you meant to put them here....
-
- <script>
- function msg()
- {
- var message=prompt("Please enter your msg","<? echo $user;?>");
-
- if (msg!=null)
- {
-
- [b]<?[/b] x="" + msg + "";
- $x1= "message"; /*this has to be hard set. it works*/
- $x2= $x ;
- $database->name($user, $x1, $x2);?>
- }
- }
- </script>
"Bring forth therefore fruits meet for repentance:" Matthew 3:8