Changing an checkbox input name with a button click function
<p>I'm running into a problem with changing the name attribute on an input element when a button is clicked.</p>

<p>I have 3 buttons:<br>
* Add Renter<br>
* Delete Customer<br>
* Update Customer</p>

<p>This is the input element:  </p>

<p><code>&lt;input type=\"checkbox\" name=\"todelete[]\" value=\"$busRow[0]\" class=\"check\" /&gt;</code>  </p>

<p>$busRow is the user's id..</p>

<p>The form is submitted to a php script that checks to see what button was set and does different actions for that button. When the user clicks the delete it loops through and deletes each customer that was in the <code>todelete[]</code> array. When the user clicks the Update Customer button i want to change the checkbox input's name to "id". Then my php script will grab the user's id instead of grabbing the array value and then redirect the user to the Update Customer page with the id stored on the URL. </p>

<p>This is the javascript i'm using at the bottom of the page:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $("button").click(function () {
        if ($(this).text() == "Update Customer") {
            $('input.check').attr("name", "id");
        }
    });
&lt;/script&gt;
</code></pre>

<p>When i get to the Update Customer page the id is not there in the URL and i can't pull any values based upon the ID :(</p>
