www.webdeveloper.com
Results 1 to 2 of 2

Thread: no showing values in text box

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    184

    Exclamation no showing values in text box

    ok i have a form where the user type in his user name and password to update the a form
    the problem is that it is not showing values in the form when the user login
    the only one that is working is where it says user name and password i dont understand why


    PHP Code:

    $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  BusinessName='$BusinessName' AND 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>";

    // new line
    echo "<pre>";
    print_r($_POST);
    echo 
    "</pre>";


              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= '$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='$BusinessName'>";





    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">' stripslashes($_POST['Description1']) . '</textarea>';

              echo
    '</td>
           </tr>
            <tr> <td> Products / Services
              </td>
           </tr>

    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' />"; 
    with

    echo "<pre>";
    print_r($_POST);
    echo "</pre>";

    i dispay when the user name log in it updates the data not problem is only when the user log in that i show all the values blank except the user_name and Password that is the one working fine

    Array
    (
    [User_Name] => franknu
    [Password] => abc123
    [submit] => LogMeIn
    )

  2. #2
    Join Date
    Apr 2005
    Location
    Bathurst, NSW, Australia
    Posts
    3,357
    Why do you have brackets around the values in the update sql?
    Are you certain that you have more data in the database? Can you see such data using phpMyAdmin?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles