i've two files one is send-data.php which contains html form and another one is receive-data.php, i am converting the form value as session value into second file and printing using echo. but it's not printing the output.

//send-data.php
<?php
session_start();              
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="receive-data.php" method="post">
<input name="cardno" type="text" size="30" />
<input name="Send" type="submit" value="submit" />
</form>
</body>
</html>

//receive-data.php
<?php
session_start();
$_SESSION=['cardno']=$_POST['cardno'];
echo "Pageviews=". $_SESSION['cardno'];
?>

Recommended Answers

All 2 Replies

$_SESSION=['cardno']=$_POST['cardno'];

Should be

$_SESSION['cardno'] = $_POST['cardno'];

thanks pritaeas

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.