
mlitch
Members-
Content Count
9 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout mlitch
-
Rank
Newbie
-
My goal seems simple: a dark green background to my table with lines alternating with a lighter green background. The problem is that I can't get rid of the areas to the left and right of each <td> where the dark green is bleeding through. I've tried setting the left/right border property to 0, the left/right margin property to 0, the left/right border property to 0; the border color to the lighter green—all with no results. The only thing that works is to use "cellpadding='0' cellspacing='0'" with the <table> tag, but this also affects the vertical spacing, which I don't want to m
-
The problem is with how to use curly braces with the $_POST variable, because this code: $i=1; while ($i<=$how_many) { ${"variable_$i"}=1000+$i; echo 'variable '.$i.' is '; echo ${"variable_$i"}; echo '<br/>'; $i=$i+1; } yields (as I expect): variable 1 is 1001variable 2 is 1002variable 3 is 1003variable 4 is 1004
-
To be more concrete, this code echo $_POST['recipient1']; echo '<br/>'; echo $_POST['recipient2']; echo '<br/>'; echo $_POST['recipient3']; echo '<br/>'; echo $_POST['recipient4']; echo '<br/>'; $i=1; while ($i<=$how_many) { ${"variable_$i"}=$_POST{"['recipient$i']"}; echo 'variable '.$i.' is '; echo ${"variable_$i"}; echo '<br/>'; $i=$i+1; } yields this: 612113variable 1 is variable 2 is variable 3 is variable 4 is Why can't I get the "while" loop to give me the same results as the statements before the "while" loop? (The variable $how
-
I need to write PHP code to handle a form. The form may have zero or more fields that are named "recipient1", "recipient2", "recipient3", etc. If there are two fields, I need to capture those fields. If there are six, I need to capture all six. Maybe there are none. I could write if (isset($_POST['recipient1'])) { $thisvariable1=$_POST['recipient1']; } if (isset($_POST['recipient2'])) { $thisvariable2=$_POST['recipient2']; } if . . . and so on. Maybe I could do 10 of these, but what if the form has 11 fields (recipient1 through recipient11)? I can't just write a hundred
-
My PHP-generated form file will generate any number of text fields called "recipient"+an integer, so "recipient1", "recipient2", etc The PHP file handling the form submission will not know how many fields there are, so I need to get something like the following logic: $i=1; $max=how many fields there are (it will know this from a mysqli_num_rows variable being passed) while ($i <= $max) { $recipient+$i = $_POST[recipient+$i] } In other words, as long as $i is less than or equal to the maximum number, generate a variable named "recipient" concatenated with $i and assign it the
-
I had to think about this for an hour or two, but now I get it. It makes perfect sense. Thank you!
- 4 replies
-
- window.close
- if
-
(and 1 more)
Tagged with:
-
Great. One more thing to learn. If all PHP code executes before javascript, though, why does the confirm box come up? That's executed before the rest of the PHP code. I don't understand why the javascript condition wouldn't also be executed before resuming with the PHP code. Sorry for being such an amateur.
- 4 replies
-
- window.close
- if
-
(and 1 more)
Tagged with:
-
Can anyone tell me why this Javascript isn't working? (The following is the PHP code:) if ($quantity>$inventory) { echo '<script language="javascript"> var i = confirm("There are '; echo number_format($inventory); echo ' copies in inventory in '; echo $warehouse_name; echo '.nnThis order is for '; echo number_format($quantity); echo ' copies.nnThat is '; echo number_format($difference); echo ' more than are available.nnClick OK to create a backorder for this itemnor Cancel to abort."); if (!i) window.close();'; echo '</script>'; } The idea is simple
- 4 replies
-
- window.close
- if
-
(and 1 more)
Tagged with: