| | |
how do i get rid of the "/"?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 227
Reputation:
Solved Threads: 0
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 .
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 Syntax (Toggle Plain Text)
<?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);?>" /> Last edited by pritaeas; Jul 29th, 2009 at 4:12 am.
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
![]() |
Similar Threads
- google "keyword" question (Search Engine Optimization)
- Removal of "Home Search Assistant", "Search Extender", & "Shopping Wizard" (Viruses, Spyware and other Nasties)
- How do I get rid of "hot corners"? (Mac tips 'n' tweaks)
- "MiCr0s0ft.exe", "Microsoftx.exe" & "ns.exe" viruses?Please Help (Viruses, Spyware and other Nasties)
- What is "via" and how can I get rid of it? (Windows NT / 2000 / XP)
- Cannot get rid of "Cannot Find Server" message (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: How to Store XAMPP in Drive D in Windows XP
- Next Thread: PHP and HTML Syntax
| Thread Tools | Search this Thread |
.htaccess action ajax apache api array auto beginner binary bounce broken cakephp checkbox class cms code cron curl database date display dynamic echo email error errorlog file files folder form format forms function functions google href htaccess html image include insert integration interactive ip java javascript joomla limit link login loop mail malfunctioning masterthesis menu mlm mod_rewrite multiple mysql nodes oop paypal pdf php popup problem query radio ram random recursion reference regex remote return script search server sessions sms soap source space sql syntax system table tutorial unset update upload url validation validator variable video web websitecontactform xml youtube





