franknu Posted April 3, 2007 Share Posted April 3, 2007 ok, this might be a simple one i ve seen it many times.. my problem is that whenever i update my database i show its and extra / in the from and back also i need to refresh my browser to see the actuall changes. i might be a problem because if the user dont see the changes right away he/she will hit submit again and then it would look like nothing change here is my code <?php $sql = "SELECT * FROM business_info WHERE BusinessName = '$BusinessName' AND User_Name = '$User_Name'"; $result = mysql_query($query) or die ("Problem with the query: <pre>$sql</pre><br>" . mysql_error()); $res2 = mysql_fetch_assoc($result); if(isset($_POST["submit"])) { $query="UPDATE business_info SET BusinessName= ('$_POST[businessName]'), `Slogan`=('$_POST[$Slogan]'), Business_Address = ('$_POST[business_Address]'), Tel=('$_POST[Tel]'), Website= ('$_POST[Website]'), Email = ('$_POST[Email]'), Fax= ('$_POST[Fax]'), `type`='$type', make = '$make', Categories = ('$_POST[Categories]'), Keyword = ('$_POST[Keyword]'), Picture1 = ('$_POST[Picture1]'), Headline = ('$_POST[Headline]'), Slogan2 = ('$_POST[slogan2]'), Description1 = ('$_POST[Description1]'), Description2 = ('$POST[Description2]'), Description3 = ('$_POST[Description3]'), Picture2 = ('$_POST[Picture2]'), Picture3 = ('$_POST[Picture3]'), `Password`= '$Password' WHERE User_Name = '$User_Name'"; $result = mysql_query($query) or die ("Problem with the query: <pre>$query</pre><br>" . mysql_error()); } echo"<table bgcolor='ffffff'>"; echo"<tr><td> <table><tr> </tr> </table> </td></tr><tr><td></td> </tr><tr><td> <table> <tr> <td><table bgcolor='ffffff'> <tr> <td> <table> "; //208 echo'<form action="'. $_SERVER['PHP_SELF'].'" method="post" enctype="multipart/form-data">'; echo"<tr>"; echo"<td> Busiess Info </td></tr><tr> <td> <table> <tr> <td> Business Name </td> <td>"; echo"<input type='text' name='BusinessName' Value=('$_POST[businessName]') > </td> </tr> <tr> <td> Slogan </td> <td>"; echo"<input type='text' NAME='Slogan' value=('$_POST[slogan]') >"; echo"</td> <td> Website </td> <td> <input type='text' name='Website' value=('$_POST[Website]') > </td>"; echo"</tr> <tr> <td> Tel </td> <td>"; echo"<input type='text' name='Tel' value=('$_POST[Tel]' )>"; echo"</td>"; echo"<td> Key Words </td> <td>"; echo"<input type='text' name='Keyword' value=('$_POST[Keyword]') />"; echo"</td> </tr> <tr> <td> Fax </td> <td>"; echo"<input type='text' name='Fax' value=('$_POST[fax]') />"; echo"</td> <td> Address </td> <td>"; echo "<input type='text' name='Business_Address' value=('$_POST[business_Address]') >"; echo"</td> </tr></table> </td></tr><tr> <td><table><tr> <td> </td> <td> </td> <td></td><td> </td><td> Category</td><td>"; echo "<TEXTAREA ROWS=5 COLS=65 NAME='Categories' value=('$_POST[Categories]') >$Categories </TEXTAREA>"; echo" </td></tr></table><table> <tr><td>Business Webpage</td> </tr><tr><td>Headline</td> </tr><tr><td>"; echo" <input type='text' name='Headline' value=('$_POST[Headline]') >"; echo" </td>"; echo" </tr>"; echo"<tr>"; echo" <td>";echo"Slogan"; echo"</td>";echo"</tr>"; echo"<tr>"; echo"<td> <input type='text' name='Slogan2' value=('$_POST[slogan2]') >"; echo"</td></tr><tr> <td> About US </td> </tr><tr><td>"; echo" <TEXTAREA ROWS=5 COLS=65 NAME='Description1' value=('$_POST[Description1]' )>$Description1 </TEXTAREA> "; echo"</td> </tr> <tr> <td> Products/ Services </td> </tr> <tr> <td>"; echo"<TEXTAREA ROWS=5 COLS=65 NAME='Description2' value=('$_POST[Description2]') />$Description2</TEXTAREA>"; echo"</td> </tr> <tr> <td> Areas Served </td> </tr> <tr> <td>"; echo"<TEXTAREA ROWS=5 COLS=65 NAME='Description3' value=('$_POST[Description3]' /)>$Description3</TEXTAREA>"; echo"</td> </tr> <tr> <td> <table>"; echo"<table>"; echo"<tr> <td>"; ?> here is my dispaly ('(\'(\\\'(\\\\\\\'massive\\\')\')') that is just an example that is for variable [businessName] please help (edited to change tags to tags) Link to comment https://forums.phpfreaks.com/topic/45430-how-to-eliminate-the-dashes-when-displaying-the-codes/ Share on other sites More sharing options...
monk.e.boy Posted April 3, 2007 Share Posted April 3, 2007 Ugh. Looks like you have magic_quotes http://uk3.php.net/magic_quotes on or you are escaping your string twice (or thrice?) monk.e.boy Link to comment https://forums.phpfreaks.com/topic/45430-how-to-eliminate-the-dashes-when-displaying-the-codes/#findComment-220593 Share on other sites More sharing options...
franknu Posted April 3, 2007 Author Share Posted April 3, 2007 isn't like adding foward slashes at the beggin and end inside the value i just dont remenber exactly i went to that link and tried stripslashes but it didnt do it Link to comment https://forums.phpfreaks.com/topic/45430-how-to-eliminate-the-dashes-when-displaying-the-codes/#findComment-220603 Share on other sites More sharing options...
kenrbnsn Posted April 3, 2007 Share Posted April 3, 2007 You seem to be adding parenthesis all over where they're not needed. Also the "<textarea>" HTML tag does not use the "value" attribute. I would let PHP create part of the query for you by doing something like this: <?php $tmp = array(); foreach($_POST as $key => $value) if ($key != 'submit') if (strlen(trim(stripslashes($value))) != 0) $tmp[] = '`' . $key . "` = '" . mysql_real_escape_string(trim(stripslashes($value))) . "'"; $query = "update business_info set " . implode(', ',$tmp) . ", `Password`= '$Password' WHERE User_Name = '$User_Name'"; ?> In your form you want to do something like this for each place you display something from the form: <?php echo '<input type="text" name="BusinessName" Value="' . stripslashes($_POST['BusinessName']) . ') > </td></tr> <tr> <td> Slogan </td> <td>'; ?> or <?php echo '<textarea rows="5" cols="65" name="Description3">'. stripslashes($_POST['Description3']) . '</textarea>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/45430-how-to-eliminate-the-dashes-when-displaying-the-codes/#findComment-220634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.