A variable I'm pulling out of a MYSQL db is being cut short when I try to display it in a form variable. The column type in the db is varchar. Here is some of the script:
<?php
include("/var/db_connect();
$fid = $_GET['id'];
$fac_array = @mysql_query("SELECT * FROM faculty WHERE ID='$fid'"
if (!$fac_array) {
die('<h2>Error retrieving faculty from database!</h2><br>' .
'Error: ' . mysql_error());
}
$fac_info = mysql_fetch_array($fac_array);
$lname = $fac_info['LNAME'];
$fname = $fac_info['FLNAME'];
$deg1 = htmlspecialchars($fac_info['DEG1']);
$deg2 = htmlspecialchars($fac_info['DEG2']);
$deg3 = htmlspecialchars($fac_info['DEG3']);
echo ("The value for deg1 is: $deg1<p>" // This prints out ok.
?>
<form action="" method="post" name="newfacutly">
<table width="97%" border="0" cellspacing="3" cellpadding="5">
<tr>
<th>Degree 1:</td>
<td>
<?php
echo ("<input name=deg1 type=text id=deg1 size=70 value=$deg1>" // This cuts off the variable as shown below.
?>
</td>
If I display the variable by itself (i.e. echo ("$deg1" it display just fine. However, as soon as I add it to a form element, it gets cut off. For example:
B.S. Univeristy of Idaho would appear as B.S.
B. S., Business Administration would appear as B.
I'm using the form so people can update information. Any ideas?
<?php
include("/var/db_connect();
$fid = $_GET['id'];
$fac_array = @mysql_query("SELECT * FROM faculty WHERE ID='$fid'"
if (!$fac_array) {
die('<h2>Error retrieving faculty from database!</h2><br>' .
'Error: ' . mysql_error());
}
$fac_info = mysql_fetch_array($fac_array);
$lname = $fac_info['LNAME'];
$fname = $fac_info['FLNAME'];
$deg1 = htmlspecialchars($fac_info['DEG1']);
$deg2 = htmlspecialchars($fac_info['DEG2']);
$deg3 = htmlspecialchars($fac_info['DEG3']);
echo ("The value for deg1 is: $deg1<p>" // This prints out ok.
?>
<form action="" method="post" name="newfacutly">
<table width="97%" border="0" cellspacing="3" cellpadding="5">
<tr>
<th>Degree 1:</td>
<td>
<?php
echo ("<input name=deg1 type=text id=deg1 size=70 value=$deg1>" // This cuts off the variable as shown below.
?>
</td>
If I display the variable by itself (i.e. echo ("$deg1" it display just fine. However, as soon as I add it to a form element, it gets cut off. For example:
B.S. Univeristy of Idaho would appear as B.S.
B. S., Business Administration would appear as B.
I'm using the form so people can update information. Any ideas?