Okay, so I'm trying to make the calculator so $person1 and $person2 get added together, and then multiplied by 4. However, when I use this method, I test it by putting 1000 in one field, 1000 in the other and the result is "5000" when it should be "8000", yet I cannot seem to figure out why.
I tried adding "* 4;" to the $answer rather than having the $multivar variable, yet still the same issue.
<?php
if (isset($_POST['person1'])) $person1 = $_POST['person1'];
if (isset($_POST['person2'])) $person2 = $_POST['person2'];
$multivar = 4;
$answer = $person1 + $person2 * $multivar;
echo <<<_END
<form method='post' action='index.php'>
<table border='0' width='500px' cellpadding='3' cellspacing='1' class="table">
<tr class="calcheading"><td colspan="2"><strong>How much can you borrow?</strong></td></tr>
<tr class="calcrow"><td>Person 1 income:</td><td align="center"><input type='text' name='person1' value="$person1"/></td></tr>
<tr class="calcrow2"><td>Person 2 income</td><td align="center"><input type='text' name='person2' value="$person2"/></td></tr>
<tr class="submit"><td colspan="2"><input type='submit' value='Calculate'/></td></tr>
_END;
?>
<tr class="calcrow">
<td><i>You can borrow up to:</td>
<td align="center"><input type="text" value="<?php echo round($answer)?>"></td></i>
</tr>
</table>
</form>
It should be:
$answer = ($person1 + $person2) * $multivar;
Multiplication is done before addition, so you have to use parentheses if you want the addition to happen first.
I agree with Mischa, but a little bit more detail is that order of operations is coming into play here - "PEMDAS". Formulas in parentheses get calculated first, then exponents, then multiplication/division across the line, then addition/subtraction across the line. So what you had written earlier was actually calculated like: 1000+1000*4 which, to the compiler looks like 1000+4000 since the multiplication is performed first. Actual code should be $answer=($person1+$person2)*$multiplier.
Related
I'm trying to get the website to send the calculation results to another page. The code below is working but I have no idea how to get the rows with the results to be shown in a new page.
I know that i have to change the action below to /mynewpage
But I just want the results not the whole table.
I have no idea what to do to the code to make it show the results only in a new page. IF everything statys in the same page the calculator works well.
It's my first attempt with PHP, I clearly have no idea of what I'm doing. Many thanks in advance.
<?php
if (isset($_POST['valuea'])) $valuea = $_POST['valuea'];
if (isset($_POST['valueb'])) $valueb = $_POST['valueb'];
if (isset($_POST['valuec'])) $valuec = $_POST['valuec'];
if (isset($_POST['valued'])) $valued = $_POST['valued'];
if (isset($_POST['valuee'])) $valuee = $_POST['valuee'];
$balance = $valuec * $valuee;
$newphone = $valuea;
$total = $balance + $valuea;
$total2 = $balance + $valueb;
echo <<<_END
<form method='post' action='/'>
<table border='0' width='500px' cellpadding='3' cellspacing='1' class="table">
<tr class="calcheading"><td colspan="2"><strong>CALCULATOR</strong></td></tr>
<tr class="calcrow"><td>Phone Value:</td><td align="center"><input type='text' name='valuea' value="$valuea"/></td></tr>
<tr class="calcrow"><td>Phone upfront cost:</td><td align="center"><input type='text' name='valueb' value="$valueb"/></td></tr>
<tr class="calcrow"><td>Monthly contract cost:</td><td align="center"><input type='text' name='valuec' value="$valuec"/></td></tr>
<tr class="calcrow"><td>Contract duration:</td><td align="center"><input type='text' name='valued' value="$valued"/></td></tr>
<tr class="calcrow"><td>No. months left in the contract:</td><td align="center"><input type='text' name='valuee' value="$valuee"/></td></tr>
<tr class="submit"><td colspan="2"><input type='submit' value='Calculate'/></td></tr>
_END;
?>
<tr class="calcheading"><td colspan="2"><strong>OPTION 1 - PAY REMAINING OF THE CONTRACT AND BUY SAME PHONE UNLOCKED</strong></td></tr>
<tr class="calcrow">
<td><i>Payment left to network:</td>
<td align="center"><input type="text" value="<?php echo round($balance)?>"></td></i>
</tr>
<tr class="calcrow">
<td><i>New unlocked phone:</td>
<td align="center"><input type="text" value="<?php echo round($newphone)?>"></td></i>
</tr>
<tr class="calcrow">
<td><i>TOTAL:</td>
<td align="center"><input type="text" value="<?php echo round($total)?>"></td></i>
</tr>
<br>
<tr class="calcheading"><td colspan="2"><strong>OPTION 2 - PAY BALANCE LEFT AND GET SAME PHONE ON A NEW CONTRACT*</strong></td></tr>
<tr class="calcrow">
<td><i>Payment left to network:</td>
<td align="center"><input type="text" value="<?php echo round($balance)?>"></td></i>
</tr>
<tr class="calcrow">
<td><i>New contract phone initial cost:</td>
<td align="center"><input type="text" value="<?php echo round($valueb)?>"></td></i>
</tr>
<tr class="calcrow">
<td><i>TOTAL:</td>
<td align="center"><input type="text" value="<?php echo round($total2)?>"></td></i>
</tr></table>
</form>
You can either send the values in a form and receive them on the other page using
$value1 = $_GET['value1'];
$value2 = $_GET['value2']; // etc
The other method would be saving them in a session variable, at the top of any pages where you wish to use session variables, call session_start(), then save them
$_SESSION['value1'] = $value1;
Then in another page, you can call them by simply
echo $_SESSION['value1'];
I'm not sure what you mean by new page? If you have a script like process.php that has that code then you can add session_start(); as your first line after the php start tag. By using $_Session['result']=$calc_result; on the 'process.php' you will store the value in your session. In the 'new page' script you call session_start(); again and you can get the stored value by saying $_Session['result'].
There are many ways to print your answers on a new page but lets keep it simple: A good way to do it would be for you to separate out the HTML form that posts the values and the php calculation logic on two different pages. So for example, your HTML form is in one file values.php (does not have any php code, you can name it with a .html prefix as well) and the php code is in another file calc.php. Now, to your form, specify an action such as
<form method='post' action='calc.php'>
This will post all the values to calc.php where your calculation code is and you can display the results however you please (not limited to a form again) but in a table or so on. Once you learn ajax, you'll never want to come back to doing this.
Here is a working barebones example: http://runnable.com/VEKvtTTrkXFwjAwL/calculator555-for-php
I've been trying to develop a real estate page where people can add listings. I am new to the world of php mysql. I have been over this problem for over a day and can't figure out where the problem is.
I have a form where people can add data. That's good and working. Now I am starting to have a place where people can add / delete / update their info. I am trying to build this step by step.
This is where a user could pull the information. My problem is with the piece of the code:
edit_form.php?idBAR=$row[id].
Full code below.
<table>
<tr>
<td align="center">EDIT DATA</td>
</tr>
<tr>
<td>
<table border="1">
<?php
include"configS_OH.php";//database connection
$order = "SELECT * FROM braaasil_brokerstour.property";
$result = mysql_query($order);
while ($row=mysql_fetch_array($result)){
echo ("<tr><td>$row[id]</td>");
echo ("<td>$row[address]</td>");
echo ("<td>$row[day]</td>");
echo ("<td>$row[hours]</td>");
echo ("<td>Edit</td></tr>");
}
?>
</table>
</td>
</tr>
</table>
Then this tutorial try to pass id through the address bar (I don't know much about php to actually say much)
It tries to upload the data into a new form where a person could edit info.
But I can't load the data into the new form. If I use where id=7, I get the info into the form. But this method of passing the info in the address bar like ?idBAR=8... and then try to catch it in the other code (where id=$idBAR), is not working.
Here is the code:
<table border=1>
<tr>
<td align=center>Form Edit Employees Data</td>
</tr>
<tr>
<td>
<table>
<?php
include "configS_OH.php";//database connection
print $database;
$order = "SELECT * FROM braaasil_brokerstour.property
WHERE id='$idBAR'";
print $idBAR;
$result = mysql_query($order) or die( mysql_error() );
$row = mysql_fetch_array($result);
?>
<form method="post" action="edit_data.php">
<input type="hidden" name="idBAR" value="<?php echo "$row[id]"?>">
<tr>
<td>Address</td>
<td>
<input type="text" name="address"
size="20" value="<?php echo "$row[address]"?>">
</td>
</tr>
<tr>
<td>Date</td>
<td>
<input type="text" name="day" size="40"
value="<?php echo "$row[day]"?>">
</td>
</tr>
<tr>
<td>Time</td>
<td>
<input type="text" name="time" size="40"
value="<?php echo "$row[hours]"?>">
</td>
</tr>
<tr>
<td align="right">
<input type="submit"
name="submit value" value="Edit">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
I tried an tried and tried..
Thank you for your time in advance.
WHERE id='$idBAR'
You haven't assigned $idBAR any value. You need to read it from the $_GET array first:
$idBAR = $_GET['idBAR'];
You should, of course, check that this value exists first, and is acceptable.
I don't see anywhere you have actually used the GET data, just the reference name which is used in GET.
If you first query is working and is getting the $row['id'] value ok - you can verify this when you go to edit_form.php, in your browser URL bar at the top, does it say this:
edit_form.php?idBAR=7
(or whatever number should be there)
If so, then you just need to use the PHP GET. Your data is stored in $_GET[], and in this case, the reference name is idBAR. So your id from your previous page query is sent through the link into your URL, and on your edit_form.php page, you'd use that data as:
$_GET['idBAR']
You can use that, but personally I assign the data to a variable, such as:
$strGetId = $_GET['idBAR'];
Then you can use $strGetId throughout your code.
Also, check things like isset(), empty() etc, just so you know you are working with A) something is actually there, and B) it's not empty etc
if you are putting a variable directly in a string without concatenating, it can't be an array variable; you must concatenate those you also need to surr. so this
echo ("<td>Edit</td></tr>");
should be this
echo ("<td>Edit</td></tr>");
also, it looks like your form is sending data with POST. When you pass form data in the url string after the question mark, that is passing with get.
so...in your form where you want to use that variable, you set it up like this
$idBAR=$_GET['idBAR']; //to get the variable if it was part of the URL
$idBAR=$_POST['idBAR']; //if it was sent with post, as is the case with your form
also, request contains both get and post, so
$idBAR=$_REQUEST['idBAR'];
will work in either case.
The problem is the $row[id] is seen as text just like everything else. You want the value of $row[id]. Instead of
echo ("<td>Edit</td></tr>");
try
echo ("<td>Edit</td></tr>");
I am trying to submit multiple arrays with a checkbox form but I am only able to submit one array at the moment, here is what I have so far
In this example I am submitting an array of numbers with the delete[] array, this array gets processed properly, I also want to submit the array condition[] this does not get processed properly, what is the best way to solve this issue?
php code
$catalog = $database->getInventory();
if($catalog){
$numRows = sizeof($catalog);//count
echo "<b>Book Count:</b> ".$numRows."<br>";
echo "<form method='post' action='inventory.php'>";
echo "<table id='example' class='tablesorter' border='0' cellpadding='0' cellspacing='1'>";
echo "
<thead>
<tr>
<th>ISBN</th>
<th>Title </th>
<th>Rank </th>
<th>Condition </th>
<th><input type='checkbox' name='delete' value='all' /></th>
</tr>
</thead>\n";
foreach($catalog as $elem){
echo "
<tr>
<td>".$elem["isbn"]."</td>
<td>".$elem["title"]."</td>
<td>".$elem["rank"]."</td>
<td>".$elem["condition"]."</td>
<td>
<input type='checkbox' name='add[]'
value='".$elem['isbn']."_".$elem['condition']."_"."' />
</td>
</tr>";
}
echo "</table>";
echo "</form>";
}
example html markup
<form method='post' action='inventory.php'>
<table>
<tr>
<td>
<input type='hidden' name='addInventoryBook' value='1'>
<input type='submit' value='Add' />
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='add[]' value='100001_used' />
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='add[]' value='100001_new' />
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='add[]' value='100003_new' />
</td>
</tr>
</table>
</form>
php function
function Inventory(){
if(isset($_POST['addInventoryBook'])){
if(isset($_POST['add']) && is_array($_POST['add'])){
$arr = array();
foreach($_POST['add'] as $checkbox){
$temp = explode("_", $checkbox);
$arr[] = array(
"isbn" => $temp[0],
"condition" => $temp[1],
"sub_condition" => $temp[2]
);
}
$this->addInventoryBook($arr);
}
else{
echo "No values have been set";
}
}
function addInventoryBook($arr){
foreach($arr as $elem){
//if used get sub-category
if($elem['condition']=='used'){
echo $elem['isbn']."-".ucfirst($elem['condition'])
.ucfirst($elem['sub_condition'])."<br>";
}
else if($elem['condition']=='new'){
echo $elem['isbn']."-".ucfirst($elem['condition'])."<br>";
}
}
}
All I want is to basically be able to pass two arrays to my php script
current output
100001
100002
100003
desired output
100001 good
100002 new
100003 new
The problem that you are having, I suspect, is that only the checkboxes that are checked will be passed back to the server, whereas all the hidden fields will always be passed so the lengths of the arrays will differ and the keys wont correspond.
The solution to this is actually relatively simple - you just need to specify the keys for the condition array so you can match the values up again. Something like this:
HTML:
<tr>
<td>
<input type='hidden' name='condition[100001]' value='good' />
<input type='checkbox' name='delete[]' value='100001' />
</td>
</tr>
<tr>
<td>
<input type='hidden' name='condition[100002]' value='new' />
<input type='checkbox' name='delete[]' value='100002' />
</td>
</tr>
PHP:
foreach ($_POST['delete'] as $delete) {
$condition = $_POST['condition'][$delete];
// Do stuff
}
This ties the values in the $_POST['condition'] array back up with the $_POST['delete'] array so everything will match up again.
EDIT
The way the keys are being created above is not great and in retrospect it is the wrong way to do it.
To demonstrate the right way to do it, let's imagine we have the following array, nice and simple:
$books = array(
10001 => 'good',
10002 => 'new',
10003 => 'new',
10004 => 'good'
);
What we need to do is tie up the two inputs that are associated with each book, which means we need a set of key/value pairs that can be matched up. That sounds like an array to me. But unlike the example above, the keys should be irrelevant to the data - they don't need to mean anything, because all we want is the data.
What we need to do is specify every single key explicitly (no stack-style array pushes) and make the keys agnostic of the data they relate to.
We can do this:
$i = 0;
foreach ($books as $isbn => $condition) {
echo "
<tr>
<td>
<input type='hidden' name='condition[$i]' value='$condition' />
<input type='checkbox' name='delete[$i]' value='$isbn' />
</td>
</tr>
";
$i++;
}
...and then, when the form is submitted, we can do this:
// We still base our code on $_POST['delete'] - because this is the array that
// depends on the user input. This time, though, we'll look at the keys as well
foreach ($_POST['delete'] as $key => $isbn) {
$condition = $_POST['condition'][$key];
// Do stuff
}
I'm a little confused about what you are asking, but I think I can simplify this for you. I don't know how you are generating the values for the hidden fields, are they hard coded? Regardless, this system would work much better if it were simplified.
Try this out....
This will combine the info for the numbers and condition, then it will split them on the backend for handling. This way the information is passed at the same time.
<tr>
<td>
<input type='checkbox' name='delete[]' value='100001-good' />
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='delete[]' value='100002-new' />
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='delete[]' value='100003-new' />
</td>
</tr>
<?php
if(isset($_POST['deleteInventoryBook'])){
if(isset($_POST['delete']) && is_array($_POST['delete'])){
foreach($_POST['delete'] as $checkbox){
$checkbox = explode('-', $checkbox);
echo $checkbox[1];
echo '<br />';
echo $checkbox[0];
echo '<br />';
}
}else{
echo "No values have been set";
}
}
?>
Again, I don't know if this is helpful or not because I was a little misunderstood about what exactly you were trying to achieve, but I hope it was helpful.
You're going to have to find a creative way to pass multiple hidden fields as an array to the PHP handler, or change how that data is collected. A "serialized" array seems to be the best bet.
This StackOverflow answer really outlines what you can do, and should still match your script's behavior. Good luck!
Ok, not exactly what I was expecting...I didn't know my code was so ureadable...sorry! What can I do to fix it? I really would like to just accomplish the (what I thought was) simple math to get totals. I've looked everywhere and read so much information on arrays and obviously I am just not grasping the concept...any more help is welcomed and would be GREATLY appreciated!
I’m creating a mock order form that has radio buttons, checkboxes and uses arrays to show the total purchase amount. I have a form that is working except for that I can't get the total amount from the two different arrays i have. $total = $extras + $additional isn't working and honestly, i should have known it couldn’t be that easy! ... Any suggestions on what formula to use so that I can get a total dollar amount of all of the options that are selected? Also, can anyone help me so that checkbox items are listed in a new row, and not a whole new table?
Thanks in advance!
A couple more things: I have to keep this in a redux and would like to keep the output in the table like it is...other than that, feel free to change whatever you want/need.
I’m new to PHP arrays and seem to only be having difficulties when it comes to their values, but since I know how important arrays are in PHP I would like to see how they work!
<?php
/*This stuff is only here because I want to make sure
there are 2 decimal places in the final numbers since
I'm dealing in "money" values*/
$total = number_format ($total,2);
$value = number_format ($value,2);
$additional = number_format ($additional,2);
$value = array("Short Trip"=>15.99, "Long Trip"=>28.99, "Overnight"=>10.99 "Forever"=>99.99);
if(isset($_POST['travel'])) {
$extras = array("Hair Brush"=>1.50, "Shampoo"=>1.50, "Toothpaste"=>1.50,
"Cream Rinse"=>1.50, "Tooth Brush"=>1.50,
"Shower Cap"=>1.50, "Washcloth"=>1.50, "Mouthwash"=>1.50);
if (isset($_POST['extras'])) {
foreach ($_POST['extras'] as $additional) {
echo "<table border =\"2\">
<tr><td>Item</td><td>Charges</td></tr>
<tr><td>".$_POST['travel']."</td>
<td> $".$value[$_POST['travel']]."</td></tr>
<tr>
<td>".$additional."</td>
<td> $".$extras[$additional]."</td>
</tr>
<tr><td>Your total</td> <td>".$total."</td></tr>
</table>";
}
}
}
?>
<html>
<body>
<form action="" method="post">
<table border="2">
<tr>
<td colspan="2" align="center" scope="col">Stay Information</td>
</tr>
<tr>
<td><input type="radio" name="travel" value="Short Trip" />Short trip $15.99</td>
<td><input type="radio" name="travel" value="Long Trip" />Long trip $28.99</td>
</tr>
<tr>
<td><input type="radio" name="travel" value="Overnight" />Overnight $10.99</td>
<td><input type="radio" name="travel" value="Forever" />Forever $99.99</td>
</tr>
</table>
<table border="2">
<tr>
<td colspan="2" scope="col">What will you need?($1.50 each)</td>
</tr>
<tr>
<td><input type="checkbox" name="extras[]" value="Hair Brush" />Hair Brush</td>
<td><input type="checkbox" name="extras[]" value="Shampoo" />Shampoo</td></tr>
<tr>
<tr><td><input type="checkbox" name="extras[]" value="Toothpaste" />Toothpaste</td>
<td><input type="checkbox" name="extras[]" value="Cream Rinse" />Cream Rinse</td></tr>
</tr>
<tr>
<td><input type="checkbox" name="extras[]" value="Tooth Brush" />Tooth Brush</td>
<td><input type="checkbox" name="extras[]" value="Shower Cap" />Shower Cap</td></tr>
<tr>
<tr><td><input type="checkbox" name="extras[]" value="Washcloth" />Washcloth</td>
<td><input type="checkbox" name="extras[]" value="Mouthwash" />Mouthwash</td></tr>
</tr>
<tr><td colspan="2">
<input type="submit" value="Submit"></td></tr>
</table>
</form>
</body>
</html>
The comments have pointed out some issues, the main one being the formatting of your code. Indeed, when trying to figure out what one did wrong in a script, confusing formatting can add hours of wasted time.
The first thing you might notice is that your $value array is missing a comma.
$value = array("Short Trip"=>15.99, "Long Trip"=>28.99, "Overnight"=>10.99 "Forever"=>99.99)
// comma here -----------------------------------------------------------^
Formatting is to some degree a matter of style, but the main point is readability, so that you can more easily catch mistakes like this.
Here is a condensed version of something what your script might look like:
<?php
$value = array(
"Short Trip" => 15.99,
"Long Trip" => 28.99,
"Overnight" => 10.99,
"Forever" => 99.99
);
$extras = array(
"Hair Brush" => 1.50,
"Shampoo" => 1.50,
"Toothpaste" => 1.50,
"Cream Rinse" => 1.50,
"Tooth Brush" => 1.50,
"Shower Cap" => 1.50,
"Washcloth" => 1.50,
"Mouthwash" => 1.50
);
// combine condititions
if (isset($_POST['travel']) && isset($_POST['extras'])) {
$total = $value[$_POST['travel']];
// start table html (before foreach loop)
// store html in a variable to print later
$html = "<table border =\"2\">
<tr>
<td>Item</td>
<td>Charges</td>
</tr>
<tr>
<td>" . $_POST['travel'] . "</td>
<td> $" . $total . "</td>
</tr>";
foreach ($_POST['extras'] as $additional) {
// add a row per extra
$html .= "<tr>
<td>" . $additional . "</td>
<td> $" . $extras[$additional] . "</td>
</tr>";
// increment total
$total += $extras[$additional];
}
$html .= "<tr>
<td>Your total</td>
<td>" . $total . "</td>
</tr>
</table>";
}
?>
<html>
<body>
<form action="" method="post">
<?php
if (isset($html)) {
echo $html;
}
?>
<table border="2">
.....
There may be further issues, as I'm not clear on which part you're having trouble, but they will now be much easier to debug.
Impressive code Doug. I hate to tell you, but I think there may be one more error. I can't figure out why, but if anyone else runs this code they would see that the math is only performed on his $1.50 "additional" items-- There isn't a working collective total.
I have a simple input form with input fields that are 3 characters wide. To gain focus to these fields however, I must click the very, very LEFT of the field, about 1 pixel or cursor width wide. The form works fine in Firefox and Safari, where you can click anywhere in the text input field to gain focus.
The form:
<form name=game_edit method=post action="?includepage=game_results.php&gameID=<?=$gameID?>" onsubmit="return validate_form();">
<table border="0" id=gameResults>
<tr><th colspan="4">RESULTS FOR: <?=$gamedate?> HOSTED BY <?=$hostName?></th></tr>
<tr>
<td colspan="2">PLAYERS: <input type=text name=playercount value="<?=$playercount?>" size="3"></td>
<td colspan="2">Championship money colleted: $<?=$champamount?></td>
</tr>
<tr><th>PLAYER</th><th>Place</th><th>Champ Discount</th><th>Didn't play</th></tr>
<? Player_list($gameID); ?>
<tr><td colspan="2"><input type="text" name="manualAdd" size="17" /></td><td colspan="2">Add a username who didn't RSVP</td></tr>
<input type=hidden name=gameID value="<?=$gameID?>">
<tr>
<td colspan="2"><input type=submit name='saveGameResults' value='SAVE CHANGES' style='width:100px;font-size:11px;'></td>
<td colspan="2" align="right"><input type=submit name='saveGameResults' value='LOCK GAME' style='width:100px;font-size:11px;'></td>
</tr>
</table>
The function that writes the fields:
function player_list($gameID)
//////////////////////////////////////////////
// Creates player list for specified //
// game. Provides input for game results. //
//////////////////////////////////////////////
{
//*****Get list of players for gameID*****
$sql = "SELECT rsvpid,rsvp.playerid,concat(fname,' ',lname) as playerName,place,points,freeChamp FROM rsvp LEFT JOIN players ON rsvp.playerid=players.id WHERE rsvp.gameID=$gameID ORDER BY place,lname";
$playerlist = mysql_query($sql);
if ($listrow = mysql_fetch_array($playerlist))
{
#--Get number of players who signed up on the website. This may differ from the actual player count --#
#--entered by the host. A player may have played but not be signed up on the website. --#
echo "<input type=hidden name='recordedPlayerCount' value='".mysql_num_rows($playerlist)."'>";
$i = 0; // index for form rows
do
{
foreach($listrow as $key=>$value) $$key = $value;
($freeChamp) ? $freeChampChecked = "checked" : $freeChampChecked = ""; //check the freechamp box if appropriate.
if ($place==100) $place="";
?>
<tr>
<td><?=$playerName?>:</td>
<td style="text-align:center"><input type=text size="2" name="place<?=$i?>" value="<?=$place?>"></td>
<td style="text-align:center"><input type=checkbox name="freeChamp<?=$i?>" value='true' <?=$freeChampChecked?>></td>
<td style="text-align:center"><input type=checkbox name="noShow<?=$i?>" value='true'></td>
<input type=hidden name="rsvpid<?=$i?>" value="<?=$rsvpid?>">
</tr>
<?
$i++; //increment index for next row
}while ($listrow = mysql_fetch_array($playerlist));
}else
echo "<tr><td colspan='4'>NO RECORDS FOUND FOR THIS GAME!</td></tr>";
}
?>
The offending form field is the "place" field...it is clickable only on the very left of the form field instead of the entire form field, in IE only. (IE 7, that I know of).
Help?
I am willing to bet that the culprit is setting the size of the input element to 2. Give this a shot and let me know if it works any better:
<td style="text-align:center"><input type=text size="3" maxlength="2" name="place<?=$i?>" value="<?=$place?>"></td>
There are other things that I notice in your code:
<tr><th>PLAYER</th><th>Place</th><th>Champ
Discount</th><th>Didn't play</th></tr>
<? Player_list($gameID); ?>
You call the function "Player_list()", but your function is named "player_list()".
foreach($listrow as $key=>$value) $$key = $value;
is the same as:
extract($listrow);
Thanks for the tips, Michael. Found the issue. I have a css-driven horizontal dropdown menu (http://www.udm4.com/) in a header div that drops down over the content div's. Above that, I have a javascript-driven login panel that can drop down over the header div. In playing around with the z-indexes so that everything played nice, I set the content div that holds the form to a z-index of -1. Even after taking out everything except that one div and that one form, IE doesn't like negative z-indexes. I don't know if negative z-indexes constitute valid CSS and IE is just being a tard again, or if other browsers are just too lenient.