Aurelijus1 Aurelijus1 - 1 year ago 62
jQuery Question

How can I get variable value from other page?

Here is my ajax code:

include_once 'dbconnect.php';

header("Location: /manopuslapis/index.php");
$res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);

mysql_query("UPDATE `users` SET credits=credits-something WHERE user_id=".$_SESSION['user']);

How can I get marked value from other page?

mysql_query("UPDATE `users` SET credits=credits-**something** WHERE user_id=".$_SESSION['user']);

Answer Source

you can use SESSION or GET to pass value to another page

using session

$_SESSION['value'] = $value ; // page 1 
$value = $_SESSION['value']; // page 2

using GET

<a href="page.php?value=<?php echo $value; ?>"></a> // page 1 
$value = $_GET['value'];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download