Jump to content

ZeroShade

Members
  • Posts

    186
  • Joined

  • Last visited

Everything posted by ZeroShade

  1. Thats the thing, I do not see the total shown after the submit is hit. Its like it refreshes the screen and the values in the text box are gone and the zero disappears. Any reason why its doing this for me?
  2. Not exactly... basically I want it to work like a calculator and the submit is the equal button. How can I get it so that when the submit button is hit... the total is then shown?
  3. I only want it to return after the submit button is hit... because i'm going to be adding equations such as 1 number times another + another and then the user hits submit and the total prints out... how can I do this?
  4. What I'm trying to get it to do is the user inputs a value into the first textbox... submit the data... and then the last echo statement returns the value on the same page. The value shows in the textbox... its returning it on the same page.
  5. Why doesn't this want to show the value in the first text box when the button is submitted? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- 60 x 25miles รท 15speed = T --> </head> <body> <form action="PassengerTrain.php" method="POST"> <?php $averageSpeed = 50; $weatherDecrease = 10; $stop = 0; $miles = $_POST['miles']; echo "<input type='text' name='miles' value='' size='1' maxlength='3' />"; echo "<input type='text' name='speed' value='' size='1' maxlength='3' />"; echo "<input type='submit' value='Submit' />"; echo $miles; ?> </form> </body></html>
  6. Ok... i understand now... thanks!!
  7. I thought the is_numeric() function returns if the number is even or not?
  8. I can't seem to get the second box to change depending on what it selected in the first box... whats wrong? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CompuDeal</title> </head> <body> <h1>CompuDeal</h1> <p />Welcome to CompuDeal! Please fill out the form below to order a computer product. Our form is simple and fool proof to use. <form action='index.php' method='POST'> <p />Computer: <select name="selectbox1" id="selectbox1" onchange="document.forms[0].submit()"> <option value='c1'>PC</option> <option value='c2'>Notebook</option> <option value='c3'>Workstation</option> </select> <p />Speed: <select name='selectbox2' id='selectbox2'> <?php $a188 = 'AMD Athlon 1.88GHz'; $a200 = 'AMD Athlon 2.00GHz'; $t220 = 'AMD Turion 2.20GHz'; $o188 = 'AMD Opteron 1.88GHz'; $o200 = 'AMD Opteron 2.00GHz'; if(isset($_POST["selectbox1"])) { echo "<option value=''>Speed:</option>"; switch ($_POST["selectbox1"]) { case 'c1': echo "<option value='c1speed1'>", $a188, "</option>"; echo "<option value='c1speed2'>", $a200, "</option>"; echo "<option value='c1speed3'>", $t220, "</option>"; break; case 'c2': echo "<option value='c2speed1'>", $t220, "</option>"; echo "<option value='c2speed2'>", $o188, "</option>"; echo "<option value='c2speed3'>", $o200, "</option>"; break; case 'c3': echo "<option value='c3speed1'>", $t220, "</option>"; echo "<option value='c3speed2'>", $t220, "</option>"; echo "<option value='c3speed3'>", $t220, "</option>"; break; } } ?> </select> <p />Memory: <select name='memory'>"; <option value='m1'>512MB</option> <option value='m2'>1GB</option> <option value='m3'>2GB</option> </select> <p />Space: <select name='space'> <option value='h1'>80GB</option> <option value='h2'>160GB</option> <option value='h3'>320GB</option> </select> <p />All computers are fully loaded and have NVIDIA 7900 GS 256MB graphic cards. <input type="submit" value="Submit" /> </form> </body></html>
  9. Is it something like this:$number = 5;if(is_numeric($number) AND getType($number))echo "<br />The number ", $number, " is even.";elseecho "<br />The number ", $number, " is odd.";???
  10. I've searched the site but I am unable to find as to how to put it into a conditional statement.
  11. I need to use a conditional statement to check if a number is an integer and that it is also even. I've never used the getType or is_numeric inside a conditional statement before. Can somebody help me out?
  12. ZeroShade

    Forms

    I'll try that to... simpler is better!
  13. ZeroShade

    Forms

    Ok... thanks! So in order for the second select to update there has to be a button to basically refresh it... do I understand that?
  14. ZeroShade

    Forms

    Hmm... I'm not understand... this is what I have: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CompuDeal</title> </head> <body> <h1>CompuDeal</h1> <p />Welcome to CompuDeal! Please fill out the form below to order a computer product. Our form is simple and fool proof to use. <form action='mailto:martin.vanputten@gmail.com' method='POST'> <p />Computer: <select name="selectbox1" id="selectbox1" onchange="document.getElementById('selectbox2').selectedIndex='0'"> <option value='c1'>PC</option> <option value='c2'>Notebook</option> <option value='c3'>Workstation</option> </select> <p />Speed: <select name='selectbox2' id='selectbox2'> <?php $a188 = 'AMD Athlon 1.88GHz'; $a200 = 'AMD Athlon 2.00GHz'; $t220 = 'AMD Turion 2.20GHz'; $o188 = 'AMD Opteron 1.88GHz'; $o200 = 'AMD Opteron 2.00GHz'; if(isset($_GET["selectbox1"])) { echo "<option value=''>Speed:</option>"; switch ($_GET["selectbox1"]) { case 'c1': echo "<option value='c1speed1'>", $a188, "</option>"; echo "<option value='c1speed2'>", $a200, "</option>"; echo "<option value='c1speed3'>", $t220, "</option>"; break; case 'c2': echo "<option value='c2speed1'>", $t220, "</option>"; echo "<option value='c2speed2'>", $o188, "</option>"; echo "<option value='c2speed3'>", $o200, "</option>"; break; case 'c3': echo "<option value='c3speed1'>", $t220, "</option>"; echo "<option value='c3speed2'>", $t220, "</option>"; echo "<option value='c3speed3'>", $t220, "</option>"; break; } } ?> </select> <p />Memory: <select name='memory'>"; <option value='m1'>512MB</option> <option value='m2'>1GB</option> <option value='m3'>2GB</option> </select> <p />Space: <select name='space'> <option value='h1'>80GB</option> <option value='h2'>160GB</option> <option value='h3'>320GB</option> </select> <p />All computers are fully loaded and have NVIDIA 7900 GS 256MB graphic cards. </form> </body></html>
  15. ZeroShade

    Forms

    I want to stay away from javascript because i am learning php right now. My mistake for putting the multiple selects inside each other... I should know better. But I don't think the onchange is working properly because there isn't anything inside the selectbox2. Any suggestions?
  16. ZeroShade

    Forms

    Hmm... I can't seem to get the information to appear in the second box. Any suggestions? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CompuDeal</title> </head> <body> <h1>CompuDeal</h1> <p />Welcome to CompuDeal! Please fill out the form below to order a computer product. Our form is simple and fool proof to use. <form action='mailto:martin.vanputten@gmail.com' method='POST'> <p />Computer: <select name="selectbox1" id="selectbox1" onchange="document.getElementById('selectbox2').selectedIndex='0'"> <option value='c1'>PC</option> <option value='c2'>Notebook</option> <option value='c3'>Workstation</option> </select> <p />Speed: <select name='selectbox2' id='selectbox2'> <?php $a188 = 'AMD Athlon 1.88GHz'; $a200 = 'AMD Athlon 2.00GHz'; $t220 = 'AMD Turion 2.20GHz'; $o188 = 'AMD Opteron 1.88GHz'; $o200 = 'AMD Opteron 2.00GHz'; if (isset($_GET["selectbox1"])) { echo "<option value=''>Speed:</option>"; switch ($_GET["selectbox1"]) { case 'c1': echo "<option value='c1speed1'>", $a188, "</option>"; echo "<option value='c1speed2'>", $a200, "</option>"; echo "<option value='c1speed3'>", $t220, "</option>"; break; case 'c2': echo "<option value='c2speed1'>", $t220, "</option>"; echo "<option value='c2speed2'>", $o188, "</option>"; echo "<option value='c2speed3'>", $o200, "</option>"; break; case 'c3': echo "<option value='c3speed1'>", $t220, "</option>"; echo "<option value='c3speed2'>", $t220, "</option>"; echo "<option value='c3speed3'>", $t220, "</option>"; break; } } echo "<p />Memory:"; echo "<select name='memory'>"; echo "<option value='m1'>512MB</option>"; echo "<option value='m2'>1GB</option>"; echo "<option value='m3'>2GB</option>"; echo "</select>"; echo "<p />Space:"; echo "<select name='space'>"; echo "<option value='h1'>80GB</option>"; echo "<option value='h2'>160GB</option>"; echo "<option value='h3'>320GB</option>"; echo "</select>"; echo "<p />All computers are fully loaded and have NVIDIA 7900 GS 256MB graphic cards."; ?> </select> </form> </body></html>
  17. ZeroShade

    Forms

    Thanks... this helps a lot. I prefer php over javascript... renders a lot faster!
  18. ZeroShade

    Forms

    I have a form with a select of thee options for "computer" and another select for three options for "speed". I have it written like this for example: echo "<option value='c1'>", $pc, "</option>"; How can I say if the user clicks on one of the three options (lets say the first one), that in the second select the three options change to match that of the first selection?
  19. I'm having a brain ######. I need the the script to show all of the data but in the last column i need it to muliply what it has there already by another amount in a nother column but same row. And I need this done for all of the rows... can somebody blow the ###### out of my head?
  20. I want to try and do it in php and stay away from javascript though. This is what i ahve so far... do u think it can be adapted because this isn't working...<?php $picture = "images\blue-carry.jpg"; echo "<a href='images\blue-carry.jpg?link = 1'><img src='$picture' border='0' /></a>"; if($_GET['link'] == 1) { $picture = "images\blue-ebook.jpg"; echo "<img src='$picture' border='0' />"; } ?>
  21. how can I say "if this link is clicked" in an if statement?
  22. My textarea will not wrap in FireFox... any suggestions?
  23. I've installed php and Apache... but apache is giving me one error when i try to restart it... could that be the error?I think i know the problem. The error is stating that it won't take a dll file to the server but when in fact i don't have a server set up yet. So once I set a server up on my own machine... then it will take it to the server and therefore allowing me to test php on my machine. I think I got it. thanks!!
  24. So before i actually make a page with php, its best to get the domain name and server space and then start testing the php?
  25. Looks the same as my code in the editor.
×
×
  • Create New...