Aurelijus1 Aurelijus1 - 4 months ago 7
jQuery Question

How can i get varriable value from other page

Here Is my ajax code:

<?php
session_start();
include_once 'dbconnect.php';

if(!isset($_SESSION['user']))
{
header("Location: /manopuslapis/index.php");
}
$res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);



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

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 
if(isset($_GET['value'])){
$value = $_GET['value'];
}
Comments