hi,
if i left a field blank in my table. when i tried to retrieve all the info out to the form. the text box supposed to have blank (because the corresponding field in the table is blank) appear a "/" ... i have tried to use trim() ... stripslashes() and none works so far. please help .

<?php
	require_once('auth.php');
	require_once('config.php');
	
	$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
	if(!$link) 
	{
		die('Failed to connect to server: ' . mysql_error());
	}
	
	//Select database
	$db = mysql_select_db(DB_DATABASE);
	if(!$db) 
	{
		die("Unable to select database");
	}
	
	$cid = $_SESSION['SESS_CUSTOMER_ID'];
	
	function clean($str) 
	{
		$str = @trim($str);
		
		while(strchr($str, '\\'))
		{
			$str = stripslashes($str);
		}
		
		if(get_magic_quotes_gpc()) 
		{
			$str = stripslashes($str);
		}
		return mysql_real_escape_string($str);
	}
	
	$qry="SELECT fname, lname, email, streetAddress,zip_id, passwd FROM customer WHERE customer_id='$cid'";
	$cResult=mysql_fetch_array(mysql_query($qry));
	
	/*
	$fn= "$cResult[0]";
	$ln= "$cResult[1]";
	$email= "$cResult[2]";
	$street= "$cResult[3]";
	$zipid= "$cResult[4]";
	$passwd = "$cResult[5]";
	*/
	$fn= clean($cResult[0]);
	$ln= clean($cResult[1]);
	$email= clean($cResult[2]);
	$street= "$cResult[3]";
	$zipid= "$cResult[4]";
	$passwd = "$cResult[5]";
	
	$qryZip ="SELECT zip, city, state_id FROM zipcode WHERE zip_id = '$zipid'";
	$zResult = mysql_fetch_array(mysql_query($qryZip));
	
	$zip="$zResult[0]";
	$city="$zResult[1]";
	$stateid = "$zResult[2]";
	
	$qryState = "SELECT state FROM state WHERE state_id = '$stateid'";
	$sResult = mysql_fetch_array(mysql_query($qryState));
	$state = "$sResult[0]";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Welcome to the member area</title>
    <link rel="stylesheet" type="text/css" href="../style.css"/> 
    <script src="../validate.js"></script>
</head>
<style type="text/css">

#menu
{
	position: relative;
	width:	800px;
	height: 100px;
	border: none;
	background-image:url(../images/menuBG.png);
}

#middleBoard
{
	position: relative;
	width: 800px;
	height: 500px;
	border: none;
	
}




</style>

<body>
	
    <div class="bxcen" id="menu">
    	<br />
        <table bgcolor="#666666", bordercolor="#666666", align="center">
            <tr height="30">
                <td class="menu" width="80">
                    <a href="../index.htm">Home</a>
                </td>
                
                <td class="menu" width="80">
                    <a href="../product.htm">Products</a>
                </td>
                
                <td class="menu" width="80">
                    <a href="../registry.htm">Register</a>
                </td>
                
                <td class="menu" width="80">
                    <a href="logout.php" >Logout</a>
                </td>
                
                <td class="menu" width="80">
                    <a href="../contact.htm">Contact us </a>
                </td>
                
                <td class="menu" width="80">
                    <a href="../faq1.htm">FAQ</a>
                </td>
                
                <td class="menu" width="80">
                	<a href="newPromotion.php">Promotion</a>
                </td>
                        
            </tr>
        </table>
    </div>
    
    <div id="middleBoard" class="bxcen">
    	<center><p style="color:#00CC00">You are logged in.</p></center>
        
        <form id="editPanel" name="editPanel" method="post" action="member-index-exec.php" >
        	<p>First Name: <input type="text" name="fn" value=<?php print($fn);?> /></p>
            <p>Last Name: <input type="text" name="ln" value=<?php print($ln);?> /></p>
            <p>Email: <input type="text" name="email" value=<?php print($email);?> /></p>
            <p>Address: <input type="text" name="street" value="<?php print($street);?>" /></p>
            <p>City: <input type="text" name="city" value=<?php print($city);?> /></p>
            <p>State: <input type="text" name="state" value=<?php print($state);?> /></p>
            <p>Zip: <input type="text" name="zip" value=<?php print($zip);?> /></p>
            <p>Password: <input type="password" name="pass" value=<?php print($passwd);?> /> (You may change your password by entering a new one)</p>
            <p>Password Confirmation: <input type="password" name="passConfirm"/>(Please enter your new password again)</p>
            <p><input type="submit" value="Save" /></p>
        </form>
</html>

<input type="text" name="state" value=<?php print($state);?> /> i think the problem here is that the " are missing around the value. Try: <input type="text" name="state" value="<?php print($state);?>" />

<input type="text" name="state" value=<?php print($state);?> /> i think the problem here is that the " are missing around the value. Try: <input type="text" name="state" value="<?php print($state);?>" />

that's good catch. Thanks much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.