Jump to content

ZeroShade

Members
  • Posts

    186
  • Joined

  • Last visited

Posts 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. echo "<input type='text' name='miles' value='" . $miles . "' size='1' maxlength='3' />";echo "<input type='text' name='speed' value='' size='1' maxlength='3' />";echo "<input type='submit' value='Submit' />";

    Well, that will return the value in the first textbox if I understood your question correctly. :)

    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 do you mean it won't show the value in the first text box?Do you mean it won't show the value at all or it won't show the value inside the text box?
    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. 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>

  7. 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.";???

  8. 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?

    Forms

    But you don't need a button, you can use onchange="document.forms[0].submit()" on the first selection-list (I think that's the right JS..)
    I'll try that to... simpler is better!

    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?

    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>

    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?

    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>

    Forms

    It is better to do this using javascript, because values in second select box change without reloading the page.Since you requested in php forum, here is an example in php.
    <html><body><form action='' method='get'>Computer: <select name='selectbox1' id='selectbox1' onchange="document.getElementById('selectbox2').selectedIndex='0';"><option value='c1'>Computer 1</option><option value='c2'>Computer 2</option><option value='c3'>Computer 3</option></select>    Speed: <select name='selectbox2' id='selectbox2'><?if (isset($_GET["selectbox1"])){	echo "<option value=''>Select speed</option>";	switch ($_GET["selectbox1"])	{		case 'c1':			echo "<option value='c1speed1'>C1 S1</option>";			echo "<option value='c1speed2'>C1 S2</option>";			echo "<option value='c1speed3'>C1 S3</option>";			break;		case 'c2':			echo "<option value='c2speed1'>C2 S1</option>";			echo "<option value='c2speed2'>C2 S2</option>";			echo "<option value='c2speed3'>C2 S3</option>";			break;		case 'c3':			echo "<option value='c3speed1'>C3 S1</option>";			echo "<option value='c3speed2'>C3 S2</option>";			echo "<option value='c3speed3'>C3 S3</option>";			break;	}}?></select>   <input type='submit' value='submit' ></form><br><?if (isset($_GET["selectbox1"]) && isset($_GET["selectbox2"]) && $_GET["selectbox2"]!=""){	echo "Computer: ".$_GET["selectbox1"]."<br>";	echo "Speed: ".$_GET["selectbox2"];}?></body></html>

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

    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?

  9. 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?

  10. Depending on what you want it to do when clicked, I think you're looking for javascript, not php. Specifically with javascript, the onclick function.
    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' />";														}												 ?>

  11. Either that, or install a webserver and PHP on your local machine to develop with.
    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!!
  12. If it looks exactly the same, where you see the PHP code, then PHP is not getting executed. You need to run the page from the server, you cannot open a local PHP file in your local web browser and have the code execute it, you need to access it through http.
    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?
×
×
  • Create New...