I have created a search box which potentially works. But I wish to insert the results in to the text box rather than having them on a new page. I have a text box called ref and a search button next to it. so When I put in a search and click search, the results should appear in the ref text box. I hope you understand what I mean. Please Help. I can post the code for the page that I wish to post the results.
Here is my code. Appreciate it <form action="test_search.php" method="get"> <input type="text" name="query" id="query" size="40" value="" action="Search.php" columns="2" autocomplete="off" delay="1500"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> <center></center> </div> <p> </p> <? $myServer = '*****'; $myUser = '****'; $myPass = '*****'; $myDB = '*******'; $SpecRef = $_GET['query']; print ("$SpecRef"); //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); //error message (not found message)begins $XX = "No Matches Found"; //query details table begins $query = ("SELECT * FROM ******** WHERE Spec_Ref LIKE'$SpecRef%' "); // $query = ("SELECT * FROM *******"); print(' is what you searched for:'); //execute the SQL query and return records $result = mssql_query($query); $numRows = mssql_num_rows($result); echo "<h1>" . $numRows . " Record" . ($numRows == 1 ? "" : "s") . " Found </h1>"; //display the results echo '<textarea>'; while($row = mssql_fetch_array($result)) { echo $row["Spec_Ref"] . "\n"; } echo '</textarea>'; //close the connection mssql_close($dbhandle); //display the results while($row = mssql_fetch_array($result)) { echo "<li>" . $row["Spec_Ref"] . "</li>"; } //close the connection mssql_close($dbhandle); //textareaContent = ""; //while ($row = @mysql_fetch_array($query)) //{ //$var1=$row["Player"]; //$var2=$row["Avg"]; //$var3=$row["HR"]; //$var4=$row["RBI"]; $textareaContent .= "Spec Ref: $var1 Avg: $var2 HR: $var3 RBI $var4 <br/>"; //} //if (!isset($var1) || $var1=="") { //echo $XX; //} ?>
Hmmm... Try my one: <? //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","USERNAME","PASSWORD"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("DATABASE") or die("Unable to select database"); //select which database we're using; ?> <?php // Get the search variable from URL $s = @$_GET['s']; $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } // Build SQL Query $query = "SELECT * FROM TABLE_NAME"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // Build SQL Query $query = "SELECT * FROM films WHERE title LIKE \"%$trimmed%\" order by title"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; // google echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set //echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $Spec_Ref = $row["Spec_Ref"]; echo "<textarea>"; echo "$Spec_Ref"; echo "</textarea>"; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo "<center> <a href=\"$PHP_SELF?s=$news&q=$var\" title=\"Next\">Next 10 >></a>"; } // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); echo "<center>"; print " <a href=\"$PHP_SELF?s=$prevs&q=$var\" title=\"Previous\"><< Prev 10</a>  "; echo "</center>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?>
Sorry forgot to take the pages out: <? //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","USERNAME","PASSWORD"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("DATABASE") or die("Unable to select database"); //select which database we're using; ?> <?php // Get the search variable from URL $s = @$_GET['s']; $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } // Build SQL Query $query = "SELECT * FROM TABLE_NAME"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // Build SQL Query $query = "SELECT * FROM films WHERE title LIKE \"%$trimmed%\" order by title"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; // google echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set //echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $Spec_Ref = $row["Spec_Ref"]; echo "<textarea>"; echo "$Spec_Ref"; echo "</textarea>"; $count++ ; } ?> PHP:
Ive troed making this work but says theres a problem with line 58 <? //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("learoyd-sql","sa","25141260"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("CompanyL") or die("Unable to select database"); //select which database we're using; ?> <?php // Get the search variable from URL $s = @$_GET['s']; $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } // Build SQL Query $query = "SELECT * FROM CompanyL.dbo.DesignControl"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; // google echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set //echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $Spec_Ref = $row["Spec_Ref"]; echo "<textarea>"; echo "$Spec_Ref"; echo "</textarea>"; $count++ ; } ?>
Sorry for my slow reply (UK time) I can do it for you if you set me an FTP account. It's too hard to do from just looking at the code. If not just play about, take anything related to pages out and Replace: echo '<textarea>'; while($row = mssql_fetch_array($result)) { echo $row["Spec_Ref"] . "\n"; } echo '</textarea>'; With echo '<textarea>'; echo '$Spec_Ref'; echo '</textarea>';
Thanks for your reply, it works. wow. I'm from UK too. Please can you help me with one last thing. Ive created a javascript in which it adds two numbers together and automatically displays the total. The problem is I can see the Java and in the broswer but not in PHP. How do I show that: This is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body,td,th { font-size: 9px; } --> </style></head> <body> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td colspan="7" valign="top"><p><strong>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Ink Lab detials</strong></p></td> </tr> <tr> <td width="61" valign="top"><p>Colour detail</p></td> <td width="84" valign="top"><p>Panthone Colour Ref</p></td> <td width="30" valign="top"><p>Line</p></td> <td width="50" valign="top"><p>Tone</p></td> <td width="50" valign="top"><p>Ink Code</p></td> <td width="39" valign="top"><p>Coverage</p></td> <td width="20" valign="top"><p>%</p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 1</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox3" id="checkbox3" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox" id="checkbox" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield12" type="text" id="textfield12" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield5" type="text" id="textfield5" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 2</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox4" id="checkbox4" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox2" id="checkbox2" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield13" type="text" id="textfield13" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield" type="text" id="textfield" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 3</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox5" id="checkbox5" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox6" id="checkbox6" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield14" type="text" id="textfield14" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield2" type="text" id="textfield2" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 4</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox7" id="checkbox7" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox9" id="checkbox9" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield15" type="text" id="textfield15" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield3" type="text" id="textfield3" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 5</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox8" id="checkbox8" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox10" id="checkbox10" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield16" type="text" id="textfield16" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield4" type="text" id="textfield4" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 6</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox11" id="checkbox11" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox15" id="checkbox15" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield17" type="text" id="textfield17" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield6" type="text" id="textfield6" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 7</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox12" id="checkbox12" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox14" id="checkbox14" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield18" type="text" id="textfield18" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield7" type="text" id="textfield7" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 8</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox13" id="checkbox13" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox16" id="checkbox16" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield19" type="text" id="textfield19" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield8" type="text" id="textfield8" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 9</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox17" id="checkbox17" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox18" id="checkbox18" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield20" type="text" id="textfield20" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield9" type="text" id="textfield9" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 10</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox19" id="checkbox19" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox20" id="checkbox20" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield21" type="text" id="textfield21" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield10" type="text" id="textfield10" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p><strong>Total</strong></p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> </p></td> <td width="50" valign="top"><p> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input name="textfield22" type="text" id="textfield22" size="1" /> </p></td> <td width="20" valign="top"><p> <input name="textfield11" type="text" id="textfield11" size="1" /> </p></td> </tr> </table> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function calcTotal(){ var q = document.getElementById("Colour 1"); var r = document.getElementById("Colour 2"); var s = document.getElementById("Colour 3"); var t = document.getElementById("Colour 4"); var u = document.getElementById("Colour 5"); var v = document.getElementById("Colour 6"); var w = document.getElementById("Colour 7"); var x = document.getElementById("Colour 8"); var y = document.getElementById("Colour 9"); var z = document.getElementById("Colour 10"); var total = (q.value*1) + (r.value*1) + (s.value*1) + (t.value*1) + (u.value*1) + (v.value*1) + (w.value*1) + (x.value*1) + (y.value*1) + (z.value*1); var a = document.getElementById("Total"); a.value = total; } </script> </head> <body> Colour 1:<input type="text" id="Colour 1" size="1" onKeyPress="calcTotal()"/><br /> Colour 2:<input type="text" id="Colour 2" size="1" onKeyPress="calcTotal()"/><br /> Colour 3:<input type="text" id="Colour 3" size="1" onKeyPress="calcTotal()"/><br /> Colour 4:<input type="text" id="Colour 4" size="1" onKeyPress="calcTotal()"/><br /> Colour 5:<input type="text" id="Colour 5" size="1" onKeyPress="calcTotal()"/><br /> Colour 6:<input type="text" id="Colour 6" size="1" onKeyPress="calcTotal()"/><br /> Colour 7:<input type="text" id="Colour 7" size="1" onKeyPress="calcTotal()"/><br /> Colour 8:<input type="text" id="Colour 8" size="1" onKeyPress="calcTotal()"/><br /> Colour 9:<input type="text" id="Colour 9" size="1" onKeyPress="calcTotal()"/><br /> Colour 10:<input type="text" id="Colour 10" size="1" onKeyPress="calcTotal()"/><br /> Total: <input type="text" disabled="disabled" size="1" id="Total" /> </body> </html>
I'm working on a math script check it out here: http://www.crazyassthings.com/test.php I've written it in PHP, not JavaScript, and it's randomly selecting numbers, I could edit this to automatically add two random numbers together and display the total. Is that the kind of thing you're looking for?
It is pretty what im looking for but not exactly. I've got Three text boxes: 1) RPT Length 2) No Round 3) Total So when I put in a number in RPT Length and No Round, it should automatically be displayed on the total.
<? $total = $No_Round + $RPT_Length; echo "$total"; ?> Try this to add up the total. It's saying the total becomes equal to the sum.
It does seem to work with this script but I cant see my HTML in dreamweaver. I can only see it in the browser. Is there anyway I can possibly convert this code into PHP. !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function calcTotal(){ var q = document.getElementById("Colour 1"); var r = document.getElementById("Colour 2"); var s = document.getElementById("Colour 3"); var t = document.getElementById("Colour 4"); var u = document.getElementById("Colour 5"); var v = document.getElementById("Colour 6"); var w = document.getElementById("Colour 7"); var x = document.getElementById("Colour 8"); var y = document.getElementById("Colour 9"); var z = document.getElementById("Colour 10"); var total = (q.value*1) + (r.value*1) + (s.value*1) + (t.value*1) + (u.value*1) + (v.value*1) + (w.value*1) + (x.value*1) + (y.value*1) + (z.value*1); var a = document.getElementById("Total"); a.value = total; } </script> <style type="text/css"> <!-- body,td,th { font-size: 9px; } --> </style></head> <body> <? $total = $No_Round + $RPT_Length; echo "$total"; ?> <p>Colour 1: <input type="text" id="Colour 1" size="1" onKeyPress="calcTotal()"/><br /> Colour 2:<input type="text" id="Colour 2" size="1" onKeyPress="calcTotal()"/><br /> Colour 3:<input type="text" id="Colour 3" size="1" onKeyPress="calcTotal()"/><br /> Colour 4:<input type="text" id="Colour 4" size="1" onKeyPress="calcTotal()"/><br /> Colour 5:<input type="text" id="Colour 5" size="1" onKeyPress="calcTotal()"/><br /> Colour 6:<input type="text" id="Colour 6" size="1" onKeyPress="calcTotal()"/><br /> Colour 7:<input type="text" id="Colour 7" size="1" onKeyPress="calcTotal()"/><br /> Colour 8:<input type="text" id="Colour 8" size="1" onKeyPress="calcTotal()"/><br /> Colour 9:<input type="text" id="Colour 9" size="1" onKeyPress="calcTotal()"/><br /> Colour 10:<input type="text" id="Colour 10" size="1" onKeyPress="calcTotal()"/><br /> Total: <input type="text" disabled="disabled" size="1" id="Total" /> </p> <p> </p> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td colspan="7" valign="top"><p><strong>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Ink Lab detials</strong></p></td> </tr> <tr> <td width="61" valign="top"><p>Colour detail</p></td> <td width="84" valign="top"><p>Panthone Colour Ref</p></td> <td width="30" valign="top"><p>Line</p></td> <td width="50" valign="top"><p>Tone</p></td> <td width="50" valign="top"><p>Ink Code</p></td> <td width="39" valign="top"><p>Coverage</p></td> <td width="20" valign="top"><p>%</p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 1</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox3" id="checkbox3" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox" id="checkbox" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" id="Colour 1" size="1" onKeyPress="calcTotal()"/> </p></td> <td width="20" valign="top"><p> <input name="textfield5" type="text" id="textfield5" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 2</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox4" id="checkbox4" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox2" id="checkbox2" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" id="Colour 2" size="1" onKeyPress="calcTotal()"/> </p></td> <td width="20" valign="top"><p> <input name="textfield" type="text" id="textfield" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 3</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox5" id="checkbox5" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox6" id="checkbox6" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" id="Colour 3" size="1" onKeyPress="calcTotal()"/> </p></td> <td width="20" valign="top"><p> <input name="textfield2" type="text" id="textfield2" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 4</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox7" id="checkbox7" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox9" id="checkbox9" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><input type="text" id="Colour 4" size="1" onKeyPress="calcTotal()"/></td> <td width="20" valign="top"><p> <input name="textfield3" type="text" id="textfield3" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 5</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox8" id="checkbox8" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox10" id="checkbox10" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><input type="text" id="Colour 5" size="1" onKeyPress="calcTotal()"/></td> <td width="20" valign="top"><p> <input name="textfield4" type="text" id="textfield4" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 6</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox11" id="checkbox11" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox15" id="checkbox15" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" id="Colour 6" size="1" onKeyPress="calcTotal()"/> </p></td> <td width="20" valign="top"><p> <input name="textfield6" type="text" id="textfield6" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 7</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox12" id="checkbox12" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox14" id="checkbox14" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><input type="text" id="Colour 7" size="1" onKeyPress="calcTotal()"/></td> <td width="20" valign="top"><p> <input name="textfield7" type="text" id="textfield7" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 8</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox13" id="checkbox13" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox16" id="checkbox16" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" id="Colour 8" size="1" onKeyPress="calcTotal()"/> </p></td> <td width="20" valign="top"><p> <input name="textfield8" type="text" id="textfield8" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 9</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox17" id="checkbox17" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox18" id="checkbox18" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" id="Colour 9" size="1" onKeyPress="calcTotal()"/> </p></td> <td width="20" valign="top"><p> <input name="textfield9" type="text" id="textfield9" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p>Colour 10</p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> <input type="checkbox" name="checkbox19" id="checkbox19" /> </p></td> <td width="50" valign="top"><p> <input type="checkbox" name="checkbox20" id="checkbox20" /> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" id="Colour 10" size="1" onKeyPress="calcTotal()"/> </p></td> <td width="20" valign="top"><p> <input name="textfield10" type="text" id="textfield10" size="1" /> </p></td> </tr> <tr> <td width="61" valign="top"><p><strong>Total</strong></p></td> <td width="84" valign="top"><p> </p></td> <td width="30" valign="top"><p> </p></td> <td width="50" valign="top"><p> </p></td> <td width="50" valign="top"><p> </p></td> <td width="39" valign="top"><p> <input type="text" disabled="disabled" size="1" id="Total" /> </p></td> <td width="20" valign="top"><p> <input name="textfield11" type="text" id="textfield11" size="1" /> </p></td> </tr> </table> <p> </p> </body> </html>
Not really, it's HTML. Unless you paid someone to convert it for you. I don't understand what you do not see in Dreamweaver? You should see the HTML, I'm not too sure about PHP because I don't use it, I use Notepad. Add me on MSN and I'll see if there's anything I can do:
I can see the HTML but not the table i created. I can only see it in the browser when i view it. how do i make it show both. I can just see the Java. see below for the code
Im currently at work at present and woudn't be possible to talk. I finish in 2 so we will chat then if its ok. You're a very kind and friendly person, thankyou friend. For the time being, is it ok if we talk here ?
I'm really confused with it. Here's your JavaScript code: <script type="text/javascript"> function calcTotal(){ var q = document.getElementById("Colour 1"); var r = document.getElementById("Colour 2"); var s = document.getElementById("Colour 3"); var t = document.getElementById("Colour 4"); var u = document.getElementById("Colour 5"); var v = document.getElementById("Colour 6"); var w = document.getElementById("Colour 7"); var x = document.getElementById("Colour 8"); var y = document.getElementById("Colour 9"); var z = document.getElementById("Colour 10"); var total = (q.value*1) + (r.value*1) + (s.value*1) + (t.value*1) + (u.value*1) + (v.value*1) + (w.value*1) + (x.value*1) + (y.value*1) + (z.value*1); var a = document.getElementById("Total"); a.value = total; } </script> PHP: And you're calling it out here: <input type="text" id="Colour 1" size="1" onKeyPress="calcTotal()"/><br /> Colour 2:<input type="text" id="Colour 2" size="1" onKeyPress="calcTotal()"/><br /> Colour 3:<input type="text" id="Colour 3" size="1" onKeyPress="calcTotal()"/><br /> Colour 4:<input type="text" id="Colour 4" size="1" onKeyPress="calcTotal()"/><br /> Colour 5:<input type="text" id="Colour 5" size="1" onKeyPress="calcTotal()"/><br /> Colour 6:<input type="text" id="Colour 6" size="1" onKeyPress="calcTotal()"/><br /> Colour 7:<input type="text" id="Colour 7" size="1" onKeyPress="calcTotal()"/><br /> Colour 8:<input type="text" id="Colour 8" size="1" onKeyPress="calcTotal()"/><br /> Colour 9:<input type="text" id="Colour 9" size="1" onKeyPress="calcTotal()"/><br /> Colour 10:<input type="text" id="Colour 10" size="1" onKeyPress="calcTotal()"/><br /> Total: <input type="text" disabled="disabled" size="1" id="Total" /> PHP: You are giving $total different names too: Total and total are different, you should keep them both as $total.
Thats because im defining where the total will be displayed. So in the variables, i have stated which colours will be used to give the total and in the bottom, them colours are displayed in the text box
var a = document.getElementById("Total"); a.value = total; PHP: Should be var a = document.getElementById("Total"); a.value = Total; PHP: Then if I'm not mistaken? And: <? $total = $No_Round + $RPT_Length; echo "$total"; ?> PHP: Should be: <? $Total = $No_Round + $RPT_Length; echo "$Total"; ?> PHP: See if that works? I'm not advanced in PHP but I can do pretty basic stuff, just see if that will work.
Sorry friend but it still not working. I can just see my table and not Java, but when i view them in the browser I can see both. Why is that?. Have i put the java in the correct place.