Ok, I am very confuse on this one,
I have a page where users can send a message into the database which eventually the business can log in and he/she can see, his/her messages. that had been posted to his business,
i am doing it with a session which, i will call later to display the messages sent to that business
my problem is that the $_SESSION[‘BusinessName’]; is not bein taken to page2. I did some testing and it takes other values to page2 but not BusinessName value
here is my code for page1 please help
[code=php]
<?php
session_start();
$_SESSION[‘BusinessName’] =’$BusinessName’;
$_SESSION[‘test’]=’test 1′; // this is the test line
?>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
</head>
if(isset($_GET[‘BusinessName’])){
$query = “SELECT * FROM business_info WHERE `BusinessName`= ‘$BusinessName’ “;
$result = mysql_query($query) or die (mysql_error());
$row = mysql_fetch_assoc($result);
$BusinessName= ($row[‘BusinessName’]);
$Keyword =($row[‘Keyword’]);
$Picture1 = ($row[‘Picture1’]);
$Headline = ($row[‘Headline’]);
$Slogan2 = ($row[‘Slogan2’]);
$Description1 =($row[‘Description1’]);
$Description2 = ($row[‘Description2’]);
$Description3= ($row[‘Description3’]);
$Contact2 = ($row[‘Contact2’]);
$Picture2 = ($row[‘Picture2’]);
$Picture3 = ($row[‘Picture3’]);
$Business_Address=($row[‘Business_Address’]);
$make=($row[‘make’]);
$type=($row[‘type’]);
$Tel=($row[‘Tel’]);
$Website=($row[‘Website’]);
}
?>
<center>
<?php
$_SESSION[‘BusinessName’];
?>
<pre>_SESSION:<?php print_r($_SESSION); ?></pre>
<table width=”200″ border=”0″ cellpadding=”0″ cellspacing=”0″ bgcolor=”#FFFFFF”>
<tr>
<td valign=”top”>
<?php include(“includefiles/banner.php”); ?>
<table width=”778″ border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
this // <pre>_SESSION:<?php print_r($_SESSION); ?></pre>
// on page1 display _SESSION:Array
(
[BusinessName] => NEW ENGLAND SEAFOODS
[test] => test 1
)
[code=php]
AND THIS IS MY CODE FOR page2
<?php
session_start();
?>
<html>
<head>
<title>Send Message</title>
<?
$BusinessName = addslashes($_POST[‘BusinessName’]);
$from = addslashes($_POST[‘from’]);
$status= addslashes($_POST[‘status’]);
$subject= addslashes($_POST[‘subject’]);
$message= addslashes($_POST[‘message’]);
$BusinessName= $_SESSION[‘BusinessName’];
if(isset($_SESSION[‘BusinessName’])){
$query = “INSERT INTO `messages` (`BusinessName`,`date`,`from`,`status`,`subject`,`message`)
VALUES (‘”.$_SESSION[‘BusinessName’].”‘,'”.$date.”‘,'”.$from.”‘, ‘”.$status.”‘,'”.$subject.”‘,
‘”.$message.”‘)”;
$result = mysql_query($query);
echo mysql_error();
if($result)
{
echo mysql_affected_rows().” .Your Message have been sent. We will get back to you. <br>”;
}
}
?>
<center>
<pre>_SESSION:<?php print_r($_SESSION); ?></pre> This on page2 display[b] SESSION:Array
(
[BusinessName] =>
[test] => test 1
)[/b]
<table width=”200″ border=”0″ cellpadding=”0″ cellspacing=”0″ bgcolor=”#FFFFFF”>
<tr>
<td valign=”top”>
<?php include(“includefiles/banner.php”); ?>
<td width=”282″><? echo'<input name=”from” type=”text” size=”60″>’; ?></td>
</tr>
<tr>
<td bgcolor=”#CCCCCC”><strong>Subject </strong></td>
<td><? echo'<input name=”subject” type=”subject” size=”60″>’; ?></td>
</tr>
<tr>
<td bgcolor=”#CCCCCC”><strong>Body</strong></td>
<td><p>
<? echo'<textarea name=”message” cols=”75″ rows=”10″></textarea>’; ?>
</p>
<p> </p></td>
</tr>
<tr>
I am able to insert all the info exept for the BusinessName wich actually is not on page2 that is why is not going into the database