Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9053023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:19:24+00:00 2026-06-16T13:19:24+00:00

I am having a problem displaying content on a table from mysql table in

  • 0

I am having a problem displaying content on a table from mysql table in the database to a form in PHP. My problem is that only the first word show on the address field for example.

Please look at my page on: http://www3.londonmet.ac.uk:8008/~iia0014/employeeManager.php

And also the cells are not aligned with the title.

Can anyone help me to solve this?

On my css I have:

table {
table-layout:fixed;
width:180%;
overflow:hidden;
border:1px ;
word-wrap:nowrap;
text-align:left;
}

But even if removing the CSS, just the first word appear.

PHP CODE:

<?php
// Connect to server and select databse.
$con = mysql_connect("$host","$username","$password");
if (!$con){
die("Can not connect: " . mysql_error());
}
mysql_select_db("$db_name",$con);

if(isset($_POST['update'])){
$UpdateQuery = "UPDATE employees SET 
Name='$_POST[name]', 
DOB='$_POST[dob]', 
Tel='$_POST[tel]', 
Address='$_POST[address]', 
Department='$_POST[department]',
PayRate='$_POST[payrate]', 
Skills='$_POST[skills]', 
Gender='$_POST[gender]' 
WHERE EmpNo='$_POST[hidden]'";               
mysql_query($UpdateQuery, $con);
 };


 if(isset($_POST['delete'])){
$DeleteQuery = "DELETE FROM employees WHERE EmpNo='$_POST[hidden]'";          
mysql_query($DeleteQuery, $con);
};

if(isset($_POST['add'])){
$AddQuery = "INSERT INTO employees (EmpNo, Name, DOB, Tel, Address, Department, PayRate,                   Skills, Gender) VALUES ('$_POST[uempNo]','$_POST

[uname]','$_POST[udob]', '$_POST[utel]','$_POST[uaddress]','$_POST[udepartment]',         '$_POST[upayrate]','$_POST[uskills]','$_POST[ugender]')";         
mysql_query($AddQuery, $con);
};



$sql = "SELECT * FROM employees";
$myData = mysql_query($sql,$con);
?>

<table border="1"  width="10%">

<?php



echo "<tr>

<th>Number</th>
<th >Employee Name</th>
<th>DOB</th>
<th>Telephone</th>
<th>Address</th>
<th>Department</th>
<th>Pay Rate</th>
<th>Skills</th>
<th>Gender</th>
</tr>";


while($record = mysql_fetch_array($myData)){
echo "<form action=employeeManager.php method=post>";
echo "<tr>";
echo "<td>" . "<input type=hidden name=hidden value=" . $record['EmpNo'] . " </td>";
echo "<td>" . "<input type=text name=name value=" . $record['Name'] . " </td>";
echo "<td>" . "<input type=text name=dob value=" . $record['DOB'] . " </td>";
echo "<td>" . "<input type=text name=tel value=" . $record['Tel'] . " </td>";
echo "<td>" . "<input type=text name=address value=" . $record['Address'] . " </td>";
echo "<td>" . "<input type=text name=department value=" . $record['Department'] . "     </td>";
echo "<td>" . "<input type=text name=payrate value=" . $record['PayRate'] . " </td>";
echo "<td>" . "<input type=text name=skills value=" . $record['Skills'] . " </td>";
echo "<td>" . "<input type=text name=gender value=" . $record['Gender'] . " </td>";
echo "<td>" . "<input type=submit name=update value=update" . " </td>";
echo "<td>" . "<input type=submit name=delete value=delete" . " </td>";
echo "</tr>";
echo "</form>";
}
echo "<form action=employeeManager.php method=post>";
echo "<tr>";
echo "<td><input type=text name=uempNo></td>";
echo "<td><input type=text name=uname></td>";
echo "<td><input type=text name=udob></td>";
echo "<td><input type=text name=utel></td>";
echo "<td><input type=text name=uaddress></td>";
echo "<td><input type=text name=udepartment></td>";
echo "<td><input type=text name=upayrate></td>";
echo "<td><input type=text name=uskills></td>";
echo "<td><input type=text name=ugender></td>";
echo "<td>" . "<input type=submit name=add value=add" . " </td></tr>";
echo "</form>";
echo "</table>";
mysql_close($con);

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:19:25+00:00Added an answer on June 16, 2026 at 1:19 pm

    In the below quotes you were missing quotes and the tags were not closed proprely!

    while($record = mysql_fetch_array($myData)){
        echo "<form action='employeeManager.php' method='post'>";
        echo "<tr>";
        echo "<td><input type='hidden' name=hidden value='" . $record['EmpNo'] . "'> </td>";
        echo "<td><input type='text' name='name' value='" . $record['Name'] . "'> </td>";
        echo "<td><input type='text' name='dob' value='" . $record['DOB'] . "'> </td>";
        echo "<td><input type='text' name='tel' value='" . $record['Tel'] . "'> </td>";
        echo "<td><input type='text' name='address' value='" . $record['Address'] . "'> </td>";
        echo "<td><input type='text' name='department' value='" . $record['Department'] . "     </td>";
        echo "<td><input type='text' name='payrate' value='" . $record['PayRate'] . "'> </td>";
        echo "<td><input type='text' name='skills' value='" . $record['Skills'] . "'> </td>";
        echo "<td><input type='text' name='gender' value='" . $record['Gender'] . "'> </td>";
        echo "<td><input type='submit' name='update' value='update'> </td>";
        echo "<td><input type='submit' name='delete' value='delete'> </td>";
        echo "</tr>";
        echo "</form>";
    }
    

    For better understanding of your mistake, notice your code:

    echo "<td><input type=text></td>";
    

    It should be like that:

    echo "<td><input type='text'></td>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a problem with displaying a content from a ArrayList() stored as
Hi I'm having a problem displaying the result I get back from my php
I'm having a problem displaying data from a function to text box within a
Im having a problem with removing non-utf8 characters from string, which are not displaying
I'm having trouble displaying an image in a UIWebView. I retrieve html content from
I'm having a problem displaying images that are not inside the application folder but
Possible Duplicate: UTF8 problem with MySQL 5 I'm having trouble displaying German Umlaute characters
I am having a very strange problem with pound signs displaying incorrectly (or not
Im having problems with displaying ONLY some elements ONLY on print page. For example
I'm building a PHP page that will load some off site content into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.