This is the rest (Web hosting services) of the if statement.

This is the rest of the if statement. If there is even one power, a row is created that contains a delete button. If not, the script creates a row that simply states that no powers have yet been entered. $delbutton =

deleting will remove all associated powers
from characters as well — select wisely

; } else { $powerchk =

No Powers entered…

; $delbutton = ; $cols = 1; } ?> We have left off some of the HTML. We assume you know HTML well enough that we don t need to explain it. As you can see in the

tag, when the user clicks the Add Power or Delete Powers button, you ll be sending values to char_transact.php:
At this point, $powerchk either contains the No Powers display, or the built-up table columns. Either way, the script inserts $powerchk into the table. Note the open and close table definitions (
and

). You didn t add them to $powerchk earlier, but you did add the internal close/open definitions to create the columns as necessary.

In the following, $delbutton either contains the row with the delete button (if powers were found), or it s blank. That is how you control when it shows up, and this is where it s inserted into the table. The following code deals with the add button. Notice that it is called action and that it has a value of Add Power. When submitting a form, PHP passes these values on to the next page. Because you are using the post method on the form, you will have a $_POST variable called action that contains the value of the button. Because of this, and because all of your forms load char_transact.php, all of your buttons are named action and have different values so that you can determine what to do with the data that is sent. We go into more detail about this when we look at char_transact.php. 305 Building Databases
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply