Jump to content

supratwinturbo

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by supratwinturbo

  1. Hi Daniel0, I understand what you mean. Let me clarify what I hope to accomplish. Basically, for each subdomain, I will have a unique index.php file. Therefore, for each subdomain, I just want to take $server and I just want to retain the main domain url (I also have several main domains, domain1.com, domain2.com, ...). So the php code I wish to accomplish will get the main domain url only (domain.com not subdomain1.domain.com). I will simply append the correct formatted subdomain string. Thank you, SupraTT
  2. Hi, I have several subdomains for my main domain. On the index.php of each sudomain, I wish to redisplay the url address but with some letters capitalized. I have the following code to get and display the url: <p> <?php $server=$_SERVER['HTTP_HOST']; echo $server; ?> </p> For example, if a user goes to http://subdomain1.domain.com, the following is displayed on the webpage: subdomain1.domain.com but I want the display to be SubDomain1.domain.com Can anyone help? Thank you, SupraTT
  3. Hi Pyrodude, First of all, thank you so much for your help. I greatly appreciate it. Secondly, you made the code more compact and made very helpful comments in it. I will study it. Again, thank you very much. SupraTT
  4. Hi Pyrodude, I am a little lost with this whole $_SESSION thing...the problem is, I am trying to have the php code control what the drop down value should be. - If user hits Calculate, the php code will reset the $units_listA back to "feet" and $units_listB back to "inch" just in case the user selected both to be "feet" or "inch." - If user hits Convert, the php code will first check what value $units_listA is and either convert "feet" to "inch" or vice versa... and the php code will then set $units_listB to the other value. How come this code has no effect....is it because I need the $_SESSION or something else.... if($Operation == "Convert") { if($units_listA=="feet") { $valueB = $valueA*12; $units_listA = "feet"; $units_listB = "inch"; } // If units_listB is set to inch, then units_listB should be set to feet and ValueB should be ValueA/12 else { $valueB = $valueA/12; $units_listA = "inch"; $units_listB = "feet"; } } As you can see I am a total newbie at this...
  5. Hi Pyrodude, Can you please provide an example for me on how to combine $_SESSIONS with the if statements for the array outputs? Thank you for the advice for the is_num statement, I will do this for my final release. Thank you.
  6. Hi All, Thank you for the replies...however, I was not detailed enough so the solution you all provided works but not the way I intended. Basically, I have what I want to do involves 2 submit buttons. I posted a simple example here: http://www.zendurl.com/supratt/test.php The user has two choices 1.) Enter height in meters and then press the CALCULATE button, which results in ValueA box to show the height in feet and ValueB box to show the height in inches. 2.) Enter a number in ValueA box, select what unit it is (feet is default) and then press the CONVERT button, which results in ValueB box (inches is default) to show the converted value with the option box with the correct unit. For example, if I enter 1 feet, ValueB box will show 12 with units of inches. This example works fine, but if I enter 1 inch for ValueA and then hit convert, ValueB's value returns 1/12, but the units for both ValueA and ValueB revert to their default units. What I want is to be able to control the options boxes' values (inch or feet) in my PHP code. Here is my code for that page. Can anyone please help me. If I am not clear, please let me know and I will try to explain better: <html> <head> </head> <body> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="GET"> <?php $h_meters = ''; $units_listA = ''; $units_listB = ''; $valueA = ''; $valueB = ''; $Calculate = ''; $Convert = ''; $Operation=$_GET["Operation"]; if(isset($_GET["h_meters"])) $h_meters= $_GET["h_meters"]; if(isset($_GET["units_listA"])) $units_listA = $_GET["units_listA"]; if(isset($_GET["units_listB"])) $units_listB = $_GET["units_listB"]; if(isset($_GET["valueA"])) $valueA = $_GET["valueA"]; if(isset($_GET["valueB"])) $valueB = $_GET["valueB"]; if(isset($_GET["Calculate"])) $Calculate = $_GET["Calculate"]; if(isset($_GET["Convert"])) $Convert = $_GET["Convert"]; // Check which submit button got pressed. // If Calculate button is pressed, convert meters to feet in ValueA textbox and to inch in ValueB textbox. if($Operation == "Calculate") { $valueA = $h_meters*3.2808399; $valueB = $valueA*12; $units_listA = "feet"; $units_listB = "inch"; } // If Convert is pressed, check what is slected in the options box. If feet is chosen in the units_listA then // when units_listB should be set to inch and ValueB should be ValueA*12 if($Operation == "Convert") { if($units_listA=="feet") { $valueB = $valueA*12; $units_listA = "feet"; $units_listB = "inch"; } // If units_listB is set to inch, then units_listB should be set to feet and ValueB should be ValueA/12 else { $valueB = $valueA/12; $units_listA = "inch"; $units_listB = "feet"; } } ?> Enter height in meters <input type="text" size="12" name="h_meters" value="<?php echo $h_meters; ?>" /> <input type="submit" name="Operation" value="Calculate" style="border-color: red; border-width: 2px;"/> <hr /> <input type="text" size="12" name="valueA" value="<?php echo $valueA; ?>" /> <select name="units_listA"> <option value="feet" "<?php if($_GET["units_listA"] == "feet") echo("Selected"); ?>">feet</option> <option value="inch" "<?php if($_GET["units_listA"] == "inch") echo("Selected"); ?>">inch</option> </select> <br /> <input type="submit" name="Operation" value="Convert" style="border-color: red; border-width: 2px;"/> <br /> <input type="text" size="12" name="valueB" value="<?php echo $valueB; ?>" /> <select name="units_listB"> <option value="inch" "<?php if($_GET["units_listB"] == "inch") echo("Selected"); ?>">inch</option> <option value="feet" "<?php if($_GET["units_listB"] == "feet") echo("Selected"); ?>">feet</option> </body> </html>
  7. I am now trying to make a form remember which color (a select list) they selected before pressing any of the submit buttons. I entered this code into the form: <select name="color"> <option value="red">red</option> <option value="blue">blue</option> </select> The submit is a GET type. For example, if the user selects blue and then clicks on either one of the "submit" buttons, I want the form to remember/show the blue option. Right now the select list always goes back to red, the first choice. I tried doing a <?php echo $red; ?> and <?php echo $blue; ?> for the option value, but this does not work since the select list needs a value.
  8. Hi Gavinandresen, Congratulations on the wonderful php function you have created. However, I wish to learn how to solve my problem with some basic php code that I can understand...I tried looking at how your code works and I am lost....sorry I am a total newbie to this. If it is possible can you please explain to me how to make php remember which <select> a user clicked? Thank you.
  9. Hi itsmeARRY, Thank you for the help. I had to modify your code to get it to work, but you pointed me in the right direction. Here is the code I used: <head> <title>Year/Age Calculator</title> </head> <body> <?php $age = ''; $year = ''; $FindAge =''; $YearBorn =''; $Operation=$_GET["Operation"]; if(isset($_GET["age"])) $age= $_GET["age"]; if(isset($_GET["year"])) $year= $_GET["year"]; if(isset($_GET["FindAge"])) $FindAge = $_GET["FindAge"]; if(isset($_GET["YearBorn"])) $YearBorn = $_GET["YearBorn"]; if($Operation == "YearBorn") { $year = 2007 - $age; } else if($Operation == "FindAge") { $age = 2007 - $year; } ?> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="GET"> <label for="Age">Age :</label><input type="text" name="age" value="<?php echo $age; ?>" /></br><br> <label for="Year">Year Born :</label><input type="text" name="year" value="<?php echo $year; ?>" /></br><br> <input type="submit" name="Operation" value="YearBorn" /> <input type="submit" name="Operation" value="FindAge" /> </form> </body> </html> I am now trying to make the form remember which color (a select list) they selected before pressing any of the submit buttons. I entered this code into the form: <select name="color"> <option value="red">red</option> <option value="blue">blue</option> </select></br>><br> For example, if the user selects blue and then clicks on either one of the "submit" buttons, I want the form to remember/show the blue option. Right now the select list always goes back to red, the first choice. I tried doing a <?php echo $red; ?> and <?php echo $blue; ?> for the option value, but this does not work since the select list needs a value. Thank you.
  10. Hi Scotty, Here is an example of what I am trying to do: <head> <title>Year/Age Calculator</title> </head> <body> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="GET"> <label for="Age">Age :</label><input type="text" id="n1" name="age" value="<?php echo $age; ?>" /></br><br> <label for="Year">Year Born :</label><input type="text" id="n2" name="year" value="<?php echo $year; ?>" /></br><br> <input type="submit" name="YearBorn" value="Find Year Born" /> <input type="submit" name="FindAge" value="Find Your Age" /> </form> <?php $age = $_GET["age"]; $year = $_GET["year"]; $YearBorn = $_GET["YearBorn"]; $FindAge = $_GET["FindAge"]; if(isset($YearBorn)) { $year = 2007 - $age; echo "Year Born = $year"; } if(isset($FindAge)) { $age = 2007 - $year; echo "Your Age = $age"; } ?> </body> </html> So in the above code, there are two textboxes, one for entering a person's Age and one for entering a person's Year of Birth. For example, if I enter 30 into the Age TextBox, I would click on the "Find Year Born" button and the php script will return the year born which will be 2007-30 = 1977. Right now the code just echos the year born onto the screen. I would like it to echo the output into the Year Born Textbox instead. So Basically, if I enter a number into the Age Textbox and Click on "Find Year Born" button, the answer will appear in the Year Born Textbox. On the other hand, if I enter a number into the Year Born Textbox and Click on "Find Your Age" button, the answer will appear in the Age Textbox. I hope I made my question clearer and that you or someone can help me. Thank you.
  11. Hi All, I have a web form composing of textboxs for users to enter numbers into. After they press submit, I have a php script that processes the numbers and now echos back the output onto the page. I would like the php output to "echo" into a textbox of the form. How can I do this? Any help would be greatly appreciated. Thank you.
  12. Hi all,       Can someone please point me in the right direction? I have been trying to figure out how people can grab the layout from a myspace page by using the friendid. I think they simply parse the myspace page for anything between <style> ... </style> and then send the code to a form. For example, this is one site that offers the feature: http://pimpyours.com/myspace_theme_stealer/index.php Here is an example friendid 31323350 Anyone have any ideas? Has someone written something similar? Your help is much appreciated. Thank you, SupraTT
×
×
  • 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.