Hey. I'm trying to set up an "edit profile" page. Say I have a textfield that loads up my address (634 southwood drive). I set the value as $street, but it's only bring up the 634 part. i think it stops reading it at the space between the number and the street name. can someone tell me how to fix this? here's my code:

$first_name = $_SESSION['first_name'];
$last_name = $_SESSION['last_name'];
$sql = mysql_query("SELECT * FROM roster WHERE first_name = '$first_name' AND last_name = '$last_name'");
$person = mysql_fetch_array($sql);

echo "<table cellpadding=3 border=1>";

echo "<tr><td><b>First Name:</b></td><td>".$person[first_name]."</td></tr>";
echo "<tr><td><b>Last Name:</b></td><td>".$person[last_name]."</td></tr>";
echo "<tr><td><b>Street:</b></td><td><input type=textfield value=".$person[street]."></td></tr>";
echo "<tr><td><b>City:</b></td><td>".$person[city]."</td></tr>";
echo "<tr><td><b>State:</b></td><td>".$person[state]."</td></tr>";
echo "<tr><td><b>Zipcode:</b></td><td>".$person[zipcode]."</td></tr>";
echo "<tr><td><b>Birth Date:</b></td><td>".$person[dob]."</td></tr>";
echo "<tr><td><b>Phone:</b></td><td>".$person[phone]."</td></tr>";
echo "<tr><td><b>Email Address:</b></td><td>".$person[email]."</td></tr>";
echo "<tr><td><b>AIM SN:</b></td><td>".$person[aim]."</td></tr>";
echo "<tr><td><b>Major:</b></td><td>".$person[major]."</td></tr>";

echo "</table>";

    Because you're not quoting your values. It has nothing to do with stripslashes or php in general, but basic html. Think about it. Given this:
    <input value=Some Thing With Spaces name=field>
    How's the HTML supposed to know where that ends? That's why you should use quotes.
    <input value="Some Thing With Spaces" name="field">

    Also, the type for the field should just be "text", not textfield. Unless you're really going for a textarea, which should be a textarea tag.

      oh. duhr. its always stupid mistakes i make.

      and textfield works fine, but thanks.

        textfield works because the default input type is text. It is incorrect for html input types though....

          Write a Reply...