Jump to content

no showing values in text box


franknu

Recommended Posts

ok, my problem is that it is not showing the values when i log in.

 

i know that the problem most be

<?php
echo '<input type="text" name="BusinessName"  Value="' . stripslashes($_POST['BusinessName']) . '" >';
?>

because once i go in and type new values it works fine. another problem is that after i hit submit i have to refresh to see what has been updated i want to be able to see right after i hit submit so that way the user wont hit submit twice

 

also my textarea are only showing this

 

$Categories on the text area  any idea please

 

<?php
$db = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
$BusinessName = (isset($_POST['BusinessName']) ? $_POST['BusinessName'] : '');
$Slogan = (isset($_POST['Slogan']) ? $_POST['Slogan']:'');
$Business_Address = (isset($_POST['Business_Address']) ? $_POST['Business_Address']:'');
$Tel = (isset($_POST['Tel']) ? $_POST['Tel']:'');
$Website = (isset($_POST['Website']) ? $_POST['Website']:'');
$Email = (isset($_POST['Email']) ? $_POST['Email']:'');
$Member_Status = (isset($_POST['Member_Status']) ? $_POST['Member_Status']:'');
$Fax =(isset($_POST['Fax']) ? $_POST['Fax']:'');
$type = (isset($_POST['type']) ? $_POST['type']:'');
$make = (isset($_POST['make']) ? $_POST['make']:'');
$Categories = (isset($_POST['Categories']) ? $_POST['Categories']:'');
$Keyword = (isset($_POST['Keyword']) ? $_POST['Keyword']:'');
$Picture1 =  (isset($_POST['Picture1']) ? $_POST['Picture1']:'');
$Headline =  (isset($_POST['Headline']) ? $_POST['Headline']:'');
$Slogan2 = (isset($_POST['Slogan2']) ? $_POST['Slogan2']:'');
$Description1 = (isset($_POST['Description1']) ? $_POST['Description1']:'');
$Description2 = (isset($_POST['Description2']) ? $_POST['Description2']:'');
$Description3= (isset($_POST['Description3']) ? $_POST['Description3']:'');
$Contact2 = (isset($_POST['Contact2']) ? $_POST['Contact2']:'');
$Picture2 =  (isset($_POST['Picture2']) ? $_POST['Picture2']:'');
$Picture3 = (isset($_POST['Picture3']) ? $_POST['Picture3']:'');
$Picture4 =  (isset($_POST['Picture4']) ? $_POST['Picture4']:'');
$User_Name = (isset($_POST['User_Name']) ? $_POST['User_Name']:'');
$Password = (isset($_POST['Password']) ? $_POST['Password']: '');

$User_Name=strtolower($_POST['User_Name']);
$Password=strtolower($_POST['Password']);

$usercheck = mysql_query("SELECT * FROM business_info where
User_Name='$User_Name' AND Password='$Password'",$db);
$userrow = mysql_fetch_array($usercheck);
$num_rows = mysql_num_rows($usercheck);

$query = "SELECT * FROM business_info where User_Name='$User_Name' AND Password='$Password'";
$result = mysql_query($query);

while ($row = mysql_fetch_assoc($result)) {
$BusinessName= $row['BusinessName'];
$Keyword = $row['Keyword'];
$Picture1 =  $row['Picture1'];
$Headline = $row['Headline'];
$Slogan =$row['Slogan'];
$Slogan2 = $row['Slogan2'];
$Description1 =$row['Description1'];
$Description2 = $row['Description2'];
$Description3= $row['Description3'];
$Contact2 =  $row['Contact2'];
$Picture2 = $row['Picture2'];
$Picture3 = $row['Picture3'];
$Categories=$row['Categories'];
$Business_Address= $row['Business_Address'];
$make=$row['make'];
$type=$row['type'];
$Tel= $row['Tel'];
$Website=$row['Website'];
}

if ($num_rows!=1)
    print "<p><b>username and/or password not found. Try again?</b></p>";
else {

   echo" <table border='0'>";
   echo"<tr>";

   echo"<td valign='top'>";
   echo"<table border='0'>";
   echo"<tr>";
   echo" <td bgcolor='cococo'>";
   echo"<a href='index.php'>";
//100

   echo"Home";
   echo"<font color='cococo'>ddddddddddddddddddddd</font></a>";
   echo"</td></tr>";
   echo"<tr>";
   echo "<td>welcome $BusinessName,  ";
   echo"<font color='ffffff'>dddddddddddddddddddfffffffffffffffffffdd</font> </td>";
   echo "</tr>";
   echo"          </table><table background='../images/fondo2.jpg'  border='1' valign='top'>";
   echo"<tr>";
   echo" <td valign='top'>";
   echo "<table border='1'background='../images/fondo2.jpg' valign='top'>";

echo"<tr>";
      echo"      <td>";
	echo"  <a href= 'http://entrepreneur.com'>Pictures Uploads/change</a>";

echo"  </td>
          </tr>

          <tr>
            <td>";
	echo"  <a href= 'http://entrepreneur.com'>Advertise your website</a>";
	echo"  </td>
          </tr><tr>
           <td></td></tr>
          <tr> <td>";
echo"<a href='http://69.89.27.201:2082/horde/index.php/'>Email</a>
	 </td></tr>
              <tr> <td></td> </tr>

<tr>
   <td>";

echo"<a href='http://www.nasdaq.com'>Stock Market</a></td>";
   echo" </tr>
            </table>
</td>
          <td  valign='top'>
<center><table border='1'>
<tr>"; //145
  echo"<td><a href=\'update.php?update=true\'>update</a></td>";

echo"<td><a href=\'keyword.php?keyword=true\'>Add Key words</a></td>";

                echo"<td><a href='http://www.ccbill.com'>CCBILL</a></td>
</tr></table>
</center> ";


$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);

{

$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="' . stripslashes($_POST['BusinessName']) . '" >';



echo '</td>';
echo'</tr> <tr> <td> Slogan </td>        <td>';

echo'<input type="text" NAME="Slogan" value="'. stripslashes($_POST['Slogan']).'" >';

echo"</td> <td> Website </td> <td>";

echo'<input type="text" name="Website" value="' . stripslashes($_POST['Website']). '" >';

echo' </td>';

echo"</tr>
        <tr>
          <td>
          Tel
          </td>
          <td>";

          echo'<input type="text" name="Tel" value="' . stripslashes ($_POST['Tel']). '" >';

         echo"</td>";
          echo"<td>
          Key Words
          </td>
          <td>";
        echo'<input type="text" name="Keyword" value="' . stripslashes($_POST['Keyword']). '" >';
       echo"</td>
       </tr>
        <tr>
          <td>
          Fax
         </td>
          <td>";
          echo '<input type="text" name="Fax" value="' . stripslashes($_POST['Fax']). '">';
          echo"</td>
          <td>
         Address
          </td>
          <td>";

echo '<input type="text" name="BusinessName"  Value="' . stripslashes($_POST['BusinessName']) . '" >';

           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="' . stripslashes($_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="' . stripslashes($_POST['Headline']).'" >';
echo" </td>";
echo"  </tr>";
        echo"<tr>";
echo" <td>
Slogan
</td>
</tr>
<tr>";

   echo '<td> <input type="text" name="Slogan2" value="' . stripslashes($_POST['Slogan2']). '" >';
echo'</td></tr><tr> <td>   About US </td> </tr><tr><td>';

  echo'<TEXTAREA ROWS=5 COLS=65 NAME="Description1"> $Description1</TEXTAREA> ';

          echo'</td>
       </tr>
        <tr> <td> Products / Services
          </td>
       </tr>
        <tr>
          <td>';
          echo'<TEXTAREA ROWS=5 COLS=65 NAME="Description2" >$Description2</TEXTAREA>';
          echo'</td>
        </tr>
        <tr>
          <td>
         Areas Served
         </td>
        </tr>
        <tr>
         <td>';
echo'<TEXTAREA ROWS=5 COLS=65 NAME= "Description3">$Description3</TEXTAREA>';
         echo'</td>
        </tr>

       <tr>
          <td>

        <table>';

echo"<table>";
echo"<tr>
<td>";

   echo" Picture1";

echo' <input name="Picture1" type="file"    value="' . stripslashes($_POST['Picture1']).'" >';

echo'</td>';
echo'<td> ';




echo"</td>";
echo"</tr>";

echo"<tr>
<td>";

   echo" Picture2";
	  echo" <input name='Picture2' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";


echo"<tr>
<td>";

   echo" Picture3";
	  echo" <input name='Picture3' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";
echo"<tr>
<td>";

   echo" Picture4";
	  echo" <input name='Picture4' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";
echo"<tr>
<td>";

   echo" Picture5";
	  echo" <input name='Picture5' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";
echo"<tr>
<td>";

   echo" Picture6";
	  echo" <input name='Picture6' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";
echo"<tr>
<td>";

   echo" Video";
	  echo" <input name='video' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";
echo"<tr>
<td>";

   echo"Sound";
	  echo" <input name='sound' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";

echo"<tr>
<td>";

   echo"You Tube";
	  echo" <input name='tube' type='file' value=''></td>
<td> <img src='dfdfd.jpg'></td>";
echo"</tr>";



echo"
  <tr>





          <td bgcolor='c0c0c0'>";

echo"<br>

<br>
               User Name";


echo" <input type='text' name='User_Name' value='$User_Name'>";


               echo" Password";


echo" <input type='text' name='Password' value='$Password'>";


echo"</td>
             </tr></tr>
</table>


                 </table>
      </td>
</tr>
  <tr>
    <td>";

    echo"<input type='submit'  value='Update my database' name='submit' />";
      echo"  <input type='reset' value='Reset fields' />";
      echo"<td>
  </form>
</table>
</td> <td></td></tr>
      </table>
   </td>
</table>
</tr>
<td>  </td>
		</td>
          <td  valign='top'> </td>
        </tr>
      </table>

  </td>
  </tr>






</table> ";

}

?>

</body>
</html>

 

(edited to change the


to


tags)

Link to comment
https://forums.phpfreaks.com/topic/45880-no-showing-values-in-text-box/
Share on other sites

Next time you post code, just post the relevant code, not your whole script, and put the code between


tags.

 

The second problem you mention comes from errors in this line:

<?php
echo '<TEXTAREA ROWS=5 COLS=65  NAME="Categories" value="' . stripslashes($_POST['Categories']).'" >$Categories </TEXTAREA>';
?>

TEXTAREA tags do not have a value attribute. Their values are placed between the <textarea> and </textarea> tags.

Also you should get into the habit of quoting all attribute values.

<?php
echo '<textarea rows="5" cols="65"  name="Categories">' . stripslashes($_POST['Categories']) . '</textarea>';
?>

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.