tags:

views:

160

answers:

7

I have the following:

 <input type="hidden" name="phone_home" value="<? echo $_SESSION['full_home_phone'] ?>">

this works for firefox but not for google chrome.. can anyone help?

thx ahead of time

+1  A: 

Let me guess...

<input type="hidden" name="phone_home" value="<? 
  echo htmlspecialchars($_SESSION['full_home_phone']) 
?>">
Tomalak
A: 

The problem could be that you are using <? ... ?>. Try <?php ... ?>.

Or you are not starting session before you are using $_SESSION.

Bakhtiyor
But he says that it works in some clients. If `<?php` or `session_start()` was the reason, it would not work at all.
Tomalak
+3  A: 

Just to make sure the problem is not something very basic: you do understand that the session is tied to the browser, and changing to Chrome will mean you don't have the session data you stored in Firefox, right?

Tgr
A: 

Depending on the doctype you use, this might be invalid HTML (no / at the end), and Chrome and Firefox handle tag soups differently. What is the actual HTML output? What do you see in Firebug / Chrome inspector?

Tgr
A: 

This is the code you want:

<?=$_SESSION['full_home_phone'];?>

Also make sure that there are no quotes or apostrophes in your phone number, and not forgetting the semi-colon at the end :)

Tim
A: 

The following code is working for me in Chrome. I think the only problem there is (<?php) tag. Try this.

<?php
     if (!isset($_SESSION)) session_start();
     $_SESSION['var_name']='some value';
?>
<form action="post">
<input type="hidden" name="phone_home" value="<?php echo $_SESSION['var_name'] ?>">     
</form>
Bakhtiyor
A: 

Have you called session_start() to initialize the user session?

Ropstah