0

i am trying to display a varchar(40) from database to php page field. the value in database is "test address" but when it displays on page it only shows "test".

Below is the code, appreciate you help.

$sql = "SELECT FIRST_NAME,LAST_NAME,ADDRESS,CITY,STATE,ZIP FROM user WHERE USER_ID='$id'";
$result = $database->query($sql);   
$row = mysql_fetch_array( $result );
    $_SESSION['fname']=ucfirst(strtolower($row[0]));        
    $_SESSION['lname']=ucfirst(strtolower($row[1]));
    $_SESSION['address']=$row[2];

<input type='text' name='street_address'DISABLED  size='75' value=";echo var_dump($_SESSION['address']);  print" />
3
  • 1
    You need to show us the SQL statement. Commented Jun 21, 2011 at 16:16
  • u mean quotes on echo statement? i thought u dont need quotes while echoing variables Commented Jun 21, 2011 at 16:24
  • 1
    I mean quotes around the html field value="" of the input tag. Commented Jun 21, 2011 at 16:25

1 Answer 1

1

I think that you are probably missing the quotes around the value. Can you paste the view source?

But, try this:

echo "<input type='text' name='street_address'DISABLED  size='75' value='";
echo var_dump($_SESSION['address']);
echo "' />";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.