会话变量作为表单值[关闭]

I am trying to set session variables as form values..

session_start();

  $_SESSION['name'] = $name[1];
  $_SESSION['phone'] = $phone[1];
  $_SESSION['email'] = $email[1];

these are my session variables and I inserted it as form value in another page..

echo '<td>Name:</td><td><input type="text" name="name" value="<?php echo $_SESSION['name']; ?>" ></td>';
  echo '</tr>';
  echo '<tr>';
  echo '<td>Phone Number:</td><td><input type="text" name="phone" value="<?php echo $_SESSION['phone']; ?>" ></td>';
  echo '</tr>';
  echo  '<tr>'; 
  echo '<td>email:</td><td> <input type="email" name="email" value="<?php echo $_SESSION['email']; ?>" ></td>';
  echo '</tr>';

but it didnt work.. it shows the following error..

Parse error: syntax error, unexpected 'name' (T_STRING), expecting ',' or ';' in C:\wamp\www\proj\editform.php on line 14

I dont understand the problem. please help..

You are using quotes wrong. This should work -

echo '<td>Name:</td><td><input type="text" name="name" value="'.$_SESSION['name'].'" ></td>';

Do this across all the input tags.

You should have:

echo '<td>Name:</td><td><input type="text" name="name" value="'.$_SESSION['name'].'" ></td>'

Same thing applies to other lines. You are using PHP code into PHP code... no sense :)