Jump to content

kikilis8

Members
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

0 Neutral

About kikilis8

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  1. I am really very confused... But it's not your fault I have the ability to confuse myself :)I corrected the code as you wrote. Something works I get alert message "myText"<?if ( ($_SERVER['REQUEST_METHOD'] == 'POST') and (isset($_POST['myNumber']) )) { $number = $_POST['myNumber']; } else confirm_msg("Doesn't work!!!");?> and then the message: "Doesn't work!!!"....It doesn't get to php... I want that user would enter the value after he press the button.
  2. My code: <script type="text/javascript">var hObj; //THE AJAX OBJECT MUST BE DECLARED GLOBALLYvar number=prompt('Insert the number');var myData = "myNumber=" + number; function hPostData(myData) { //THIS FUNCTION SENDS THE DATA hObj = null; var myURL = "lt_zoleliu_misiniai.php"; //CHANGE THIS TO YOUR PHP SCRIPT URL if (hObj = getHObject()){ hObj.onreadystatechange = hStateChanged; //POINTS TO THE FUNCTION BELOW hObj.open ('POST', myURL, true); hObj.send (myData); }else {alert ("Cannot get an HTTP object");} }//..........//the rest of code I have not change In P
  3. The variable which I want to use in php code is $number. function printResponse(myText) { //THIS IS JUST A RETURN FUNCTION; ALERT IS A BASIC TEST alert('myText'); } instead alert('myText'); I should write my funcion var number=prompt('Insert the number'); Is it correct? function hPostData(myData) { //THIS FUNCTION SENDS THE DATA What should I enter in myData?What functions do I need to use to get number value to php? <?php$number = ??????????? if ($number>0) { .... code ... }?>
  4. Could someone explane me above AJAX example please? I need to get value from prompt() to php. How to use AJAX?Thank you!
  5. $url = 'http://www.jadvyga.lt/index.php';$url .= '?language=lt';echo '<a href="'.$url.'"><img src="images/lt_flag.gif" border="1"></a>';$url = 'http://www.jadvyga.lt/index.php';$url .= '?language=en';echo '<a href="'.$url.'"><img src="images/en_flag.gif" border="1"></a>'; My code above works fine now. At least it seems like when i change the language it opens home page.
  6. if I use the code like justsomeguy suggested $url = '?';foreach ($_GET as $k => $v) $url .= urlencode($k) . '=' urlencode($v) . '&';$url .= 'language=lt';echo '<a href="' . $url . '" ><img src="images/lt_flag.gif" border="1"></a>'; i have error: Parse error: syntax error, unexpected T_STRINGon line: $url .= urlencode($k) . '=' urlencode($v) . '&';
  7. What does variables $k and $v mean? What values should i set?
  8. I have asked above but i will repeat my question again .How to change location after the flag to change language is pressed? Reg Edit wrote a comment for me: "don't embed an element with an onclick handler within an anchor; use either onclick or href, not both. "So, what is the other way to change location?Please, Help!!!!
  9. I want to order by second word in the field.I have a query: $rez = mysql_query("SELECT `augalas_lot`,`augalas_lt` FROM `herbs_exposition` ORDER BY `augalas_lt`"); It orders by first word of the field augalas_lt. Example of field augalas_lt:Stambiašaknis snaputisStoralapė bergenijaTamsiažiedė dedešvaTankiažiedė rūgštynėand so on.I can not separate them to different fields. How to make it sort by second word?It should look like this:Storalapė bergenijaTamsiažiedė dedešvaTankiažiedė rūgštynėStambiašaknis snaputisThank you in advance!
  10. if I leave only echo getenv('PHP_SELF')."?language=lt"; after changing the language second time it gives this warning:"Warning: array_key_exists() The second argument should be either an array or an object"I can not leave with &language echo getenv('PHP_SELF')."&language=lt"; also, because language should start with ? but not with &.
  11. Could you give an example how to get value from prompt() to php with AJAX please? Or any other example, because I can not find the solution...Thank you!
  12. I am tiring to learn php too :)My code was OK, it needs else, because otherwise you can change language only once and later - errors. Once it takes "?language=lt", when it goes to else - "&language=lt". So difference is ? and &.Do you have any ideas how to change location after the flag is pressed to change language?
  13. if I use PHP_SELF instead of REQUEST_URI, if i use second time the language, it tries to open http://www.jadvyga.lt/&language=lt what means - page not found. It doesn not "keep" the file name.And what would you suggest, if I want to make that after choosing language the location would be changed?
  14. I tried your suggestions, but still it doesn't work... How i have mention above, everything works if I apply the code for other image, but for language image it does not work... And I do not have any ideas what could cause the problem.
  15. I want to make that changing the language from one to the other it would open home page. But i face one problem that it does not react to the function onclick=\"java script:newLocation()\". It does not show any error, but it does not work... How you can see in my code OnClick i tried in two places: first in <a href, second in <img . It does not work exactly for this code, which is written to change language. I have tried to use the function onclick=\"java script:newLocation()\" for other picture, it forks fine... Where is the problem and how to solve it?Thank you in advance! <scrip
×
×
  • Create New...