Is there a reason why this won't take aciton or submit. I don't get any movement on the browser. Neither of the forms move.

<div data-role="content">
    <?php
        echo "<table width=\"500\" border=\"1\" cellpadding=\"4\">";
            while($row = mysql_fetch_array($showEmployees))
            { 
            echo "
                <div data-role=\"collapsible\" data-mini=\"true\" data-content-theme=\"c\">
                <h3>{$row['employee']}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$row['phone']}</h3>
                <p>
                    <form action='admin.php' method='post' accept-charset='UTF-8' id='editemployee' >
                    <div data-role=\"fieldcontain\">
                        <input type='hidden' name='employeeid' id='employeeid' value='{$row['id']}'/>
                        <label for='employee' >Name:</label>
                        <input type='text' name='employee' id='employee' value='{$row['employee']}'/><br/>
                        <label for='phone' >Phone#:</label>
                        <input type='text' name='phone' id='phone' value='{$row['phone']}'/><br />
                        <label for='management' >Management: {$row['management']}</label>
                        <select name=\"management\" id=\"management\" data-role=\"none\">
                        <option value=\"0\">No</option>
                        <option value=\"1\">Yes</option>
                        </select><br />
                        <label for='active' >Active: {$row['active']}</label>
                        <select name=\"active\" id=\"active\" data-role=\"none\">
                        <option value=\"1\">Yes</option>
                        <option value=\"0\">No</option>
                        </select><br />

                        <input type='submit' name=\"Submit\" value='Submit {$row['employee']}' />
                    </div>
                    </form>
                        <form action='admin.php' method='post' accept-charset='UTF-8'>
                        <div data-role=\"fieldcontain\">
                        <label for='deleteThisEmployee' ><h1>Delete:</h1></label>
                        <input type='hidden' name='deleteThisEmployee' id='deleteThisEmployee' value='{$row['id']}'/>
                        </div>
                        <input type=\"submit\" data-theme=\"a\" name=\"deleteEmployee\" id=\"deleteEmployee\" value=\"{$row['employee']}\">
                    </form>
                </p>
                </div>
            ";
        };
        echo "</table>";
    ?>
</div><!-- /content -->

Yes there are many reasons , the first is that you mix the view with the logic ,

the second one is that you are using mysql_fetch_array that is deprecated and really bad practice many-many years now ,

the third one is that you use brackets as if is something on them e.g. {$row['employee']} of course that is {value} ,

the fourth one and the most important is that you generate in html really a lot of bunch of forms , in each while you generate html for 2 (two) forms , the number of forms that you generate is the number of rows multiplied by two , so which one of all of them are you submitting ?

Thank you so much for the heads up. Let me see where follow.

....Yikes

  1. "mix the view w/ the logic"...I'm not following. I'm sorry.
  2. What is up to date besides: mysql_fetch_array()

    1. What should {$row['employee']} be......{?}
  3. Got it! No more than one form in one while?

Link me to death if need be. I thank you for the insight. It's good to get a update on the old stuff I was reading.

mysql_num_rows will be in handy
remove curly brackets

the second one is that you are using mysql_fetch_array that is deprecated and really bad practice many-many years now ,

Bit misleading there i fear, not only is mysql still in use and not deprecated AFAIK, it's not likely to be either, although it's recommended to use PDO with mysql or procedural mysqli.
I'm sure I will be corrected if I am wrong.

commented: You're correct on what he should be using to connect to MySQL +7

My bad there, mysql is deprecated, but may be used for some time yet, apparently. Teach me to keep up eh?

If you're using PHP 5 or higher it is recommended to use PDO or mysqli, so you are correct on that part TonyG_cyprus. The mysql function is deprecated in 5.5.0 and will be completely removed in a future release after 5.5.0

If you are not sure which (PDO or mysqli) to use to make the connection, here is a nice break down of the differences
http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/

I don't understand the fuss about the curly brackets, it is allowed and a correct way to include a variable in a double quoted string or heredoc.

commented: I was wondering this too. +5

I don't understand the fuss about the curly brackets, it is allowed and a correct way to include a variable in a double quoted string or heredoc.

I didn't even read that far into it. I agree, there is nothing wrong with using {}.

What does the output of this look like in a browser? Maybe the while loop is creating a problem or possible something else outside of the code shown here.

Every form has the same id
change to
<form action='admin.php' method='post' accept-charset='UTF-8' id='editemployee{$row['id']}' >

do something simular for the id of the input fields

quote from php manual http://php.net/manual/en/function.mysql-fetch-array.php stating deprecation of mysql_fetch_array()

Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:

mysqli_fetch_array()
PDOStatement::fetch()

As per the doubt.I can see that page is redirected to admin.php on form submit.I am not sure about the condition.I am assuming that you are getting data from database.

pls repost your new edited code of this problem I think I can see where the error is. Lemme see if your edited code stuff is still the same manner. All the variables are enclosed on echo function. you forgot something to do to retrieve it properly. (.)<--this is the clue

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.