Hi,
THis is driving me nuts, but it's gotta be something simple.... the LC script below works perfectly when triggered in the run mode of the IDE on the desktop..., but when the same simple file is saved as HTML, nothing makes it through to the server. Can someone suggest what is going on?
on mouseUp
put "tStudentName=" & URLencode("Typhoid Mary") into tStudentName
Post tStudentName to URL "http:....php"
end mouseUp
on the server end, I have a PHP file running this code:
<?php
$tStudent = $_REQUEST['tStudentName'];
mail("goodemail@correctaddress", "Test",$tStudent);
?>
html5 POST fails... why?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 17
- Joined: Thu Mar 26, 2020 8:23 pm
Re: html5 POST fails... why?
Never got the POST version to work, but a version with GET does work:
on mouseUp
put URLencode("Spanish") into tArray["tLang"]
put URLencode("Typhoid Mary") into tArray["tStudentName"]
put "?tLang=" & tArray["tLang"] & "&tStudentName=" & tArray["tStudentName"] into tDataToSend
Get URL ("https://....php" &tDataToSend)
end mouseUp
Two things seem to have made a difference:
1) moving http to https
2) using the GET URL (...) command (with the variable call via "?", of course)
Still would love to know why POST fails here (I would prefer to use it over GET, but I'm up against some deadlines).
L P B
on mouseUp
put URLencode("Spanish") into tArray["tLang"]
put URLencode("Typhoid Mary") into tArray["tStudentName"]
put "?tLang=" & tArray["tLang"] & "&tStudentName=" & tArray["tStudentName"] into tDataToSend
Get URL ("https://....php" &tDataToSend)
end mouseUp
Two things seem to have made a difference:
1) moving http to https
2) using the GET URL (...) command (with the variable call via "?", of course)
Still would love to know why POST fails here (I would prefer to use it over GET, but I'm up against some deadlines).
L P B
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: html5 POST fails... why?
Have you learned anything more about using POST with html5 standalones? I cannot get my POST command to work at all. I tried your GET solution, and can't get that to work either. I'm using https, and the html is being served on the same domain as the app server.
Re: html5 POST fails... why?
Hi LeProfBard and adventuresofgreg,
I had the same problem with the POST command not working with HTML5 standalones.
I reported a workaround that works for me in another thread:
viewtopic.php?f=120&t=34730&p=197208#p197208
It is basically about using the javascript enverinmont the HTML5 app is running in (as far as iI understand).
You insert a javascript post command and run it in your LiveCode app via the do function (https://livecode.fandom.com/wiki/Do), which allows you to execute some javascript code in your App.
So far, this works fine for me.
Hope it helps!
Best,
Martin
I had the same problem with the POST command not working with HTML5 standalones.
I reported a workaround that works for me in another thread:
viewtopic.php?f=120&t=34730&p=197208#p197208
It is basically about using the javascript enverinmont the HTML5 app is running in (as far as iI understand).
You insert a javascript post command and run it in your LiveCode app via the do function (https://livecode.fandom.com/wiki/Do), which allows you to execute some javascript code in your App.
So far, this works fine for me.
Hope it helps!
Best,
Martin