Jump to content

Btown2

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Btown2's Achievements

Member

Member (2/5)

0

Reputation

  1. Thank you, that was driving me insane.
  2. Why isn't my function btnClick() being called when the form is submitted?? <html> <head> <title>Test</title> <script type='text/javascript'> function btnClick() { alert("got called"); var field = document.getElementById("gID"); var txt = field.value; if(txt == "") { alert("You must enter a game ID."); return false; } else { alert("went down else path"); var state = getState(txt); document.write(state); return true; } } function getState(var id) { var xmlhttp; if(window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if(readyState == 4) { var response = xmlhttp.responseText; return response; } } var url = "returnCurrentGameState.php?id="+id; xmlhttp.open("GET",url,true); xmlhttp.send(null); } else { alert("Browser not supported."); } } </script> </head> <body> <center> <form onSubmit="return btnClick();"> <input id="gID" type="text"> <input type="submit" value="Submit"> </form> </center> </body> </html>
  3. ensure that in the IIS manager your site allows for anonymous connections. Also ensure that your index.php file is listed in the default documents section, and that the mime types allow .php extensions to be served.
  4. Heres a mail script i wrote for our error report form. $director = $_POST['director']; $room = $_POST['room']; $class = $_POST['class']; $description = $_POST['description']; $to = "SomoneWhoCares@someplace.com"; $subject = "Error Log: ".$room."."; $msg= "From: ".$director."\n"."\n"."Room: ".$room."\n"."\n"."Class: ".$class."\n"."\n"."Description:"."\n".$description; $headers = "From: SomoneWhoCares@someplace.com\r\nReply-To: SomoneWhoCares@someplace.com"; mail("$to", "$subject", "$msg", "$headers") or die("Error sending mail in error_log.php @ line 97."); echo "Error logged. Thank You. Please return <a href='index.php'>Home</a>";
  5. ok heres the issue. Im trying to weed out entries that dont fill in all of the info. The issue is that my if statement isnt ever evaluating to true. Can anyone explain to me why? (it always runs the else block that calls the mail() function.) if(isset($_POST['incoming_data'])) { if(!isset($_POST['director']) || !isset($_POST['class']) || !isset($_POST['description'])) { echo "Error! All fields must be filled out!"; } else { $director = $_POST['director']; $room = $_POST['room']; $class = $_POST['class']; $description = $_POST['description']; //do a mail() call } }
  6. I dont know if this is the main issue, but you have a syntax error in your last post var. You have $TrackingNum=$_POST['TrackingNum]' it should be $TrackingNum=$_POST['TrackingNum']; Also just saw somthing else. I think your if statement that checks $result is a tautology. Since $result wouldn't be null because it would evaluate as true all the time, thus lieing to you. But i am rusty on my php so i could be wrong.
  7. Thank you for your post. It has been very helpful to hear the other side of the arguments.
  8. Hey everyone, i was wondering if you could help me with a school project i have to do. It is very simple, my task is simply to start a discusion on a web forum about electric cars. So to help me all you need to do is reply to this thread with your thoughts/ concerns. Ok I'll start off here. I believe electric cars to be a great way to permanently get us off of foreign oil. They are easier to maintain than gas cars. They can be charged up by green energies (solar/wind/tidal/hydroelectric). They won't pollute the enviornment. They actually accellerate a lot faster than gas cars. They are very quiet when running and can support all of the major luxories we have come to have in cars. And battery life continues to get better each year. Not to mention the energy cost to run one is tiny compared to a gas car. So if electric are this great, why don't we see them everywhere? With energy the way it is today why doesn't Ford or GM start mass producing electric cars? ??? So if i could just have your thoughts/ concerns on the issue please.
  9. try this... $status = mysql_fetch_array($result3) or die(mysql_error()); if($status[0] == "Super Administrator")
  10. A lot of times i see people asking for an easy way to remove tables from their databases. So here I submit this simple script that gets all of the tables in a DB, lists them with a checkbox, and remove the checked ones. It is very useful for dropping a lot of tables without worry of dropping ones you still need (ie phpbb2 stuff and the like). So give it a try, tell me what you think and enjoy. ps. I set it up to target dbcleaner.php in the form so either name the file dbcleaner.php or change it accordingly. <!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>DB cleaner</title> </head> <body> <?php $dbname = ""; $dbpass = ""; $server = ""; $username = ""; mysql_connect($server,$username,$dbpass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); if(isset($_POST['submit'])) { $selected_tables = $_POST['verify']; foreach($selected_tables as $table_to_delete) { $query = "DROP TABLE ".$table_to_delete; mysql_query($query) or die(mysql_error()); echo $table_to_delete." has been deleted.<br>"; } echo "<a href='dbcleaner.php'>More cleanup?</a>"; } else{ $query = "SHOW TABLES"; $result = mysql_query($query) or die(mysql_error()); $num_rows = mysql_num_rows($result); echo "<center><table border='1'><th>".$num_rows." tables found.</th><th>Remove from database?</th>"; echo "<form action='dbcleaner.php' method=post>"; $i = 0; for(;$i < $num_rows; $i++) { $table = mysql_fetch_array($result); echo "<tr><td>".$table[0]."</td><td><input type=checkbox name='verify[]' value='".$table[0]."'></td></tr>"; } echo "</table>"; echo "<br><input type=submit value='Clean the DB' name='submit'>"; } ?> <p>© Written by Brayton Thompson with free use for all</p> </center> </body> </html>
  11. wow, thnx for the speedy replies guys.
  12. was wondering if anyone could explain why my container div wont center? my book says this should work but its not in IE7. body { margin: 0; padding: 0; } div { border: 1px solid #000; padding: 20px; margin: 10px; background: #fff; } #container { margin: 0 auto; width: 750px; padding: 20px; border: 1px solid #000; background: #CCC; } .box { margin: 10px; padding: 20px; border: 1px solid #000; background: #09f; width: 75%; } .box p { color: #00f; font-size: 2em; } heres the markup <html> <head> <title>Testing css</title> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> <div id="container"> <p>content</p> <div class="box"> <p>im in a box</p> </div> <div class="box"> <p>me 2</p> </div> <div> <p>im boxed?</p> </div? </div> </body> </html>
  13. The simple answer is to use if statements to check that each variable you want to insert has been set. There are a few ways to do this... 1. regex (probably a little to advance at this point, but may be helpful in the future for keeping out malicious db entries) 2. simple isset if(!isset($var)){ $error = 'true';} for example if(!isset($username)) { $errormsg = 'You did not enter a username.'; die($errormsg); } if(!isset($password)) { $errormsg = 'You did not enter a password.'; die($errormsg); } if(!isset($anything)) { $errormsg = 'You did not enter a blah blah blah'; die($errormsg); } /*now if it makes it through all of the checks insert the data.*/ $query = 'insert your data here'; this is just psuedocode, so please make changes as nessecary ps: i know my spelling sux.
  14. <html> <body> <table> <tr><td>Name:</td><td>/*firstname stuff goes here*/</td></tr> <tr><td>Item 1:</td><td>/*item 1 stuff here*/</td></tr> <tr><td>Item 2:</td><td>/*item 2 stuff*/</td></tr> <tr><td>Date:</td><td>/*date stuff goes here*/</td></tr> </table> </body> </html> this will get you the format you wanted.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.