Like SystemiConnectFri 15 Oct 2021, 04:50
Auto Save MessagesLGforumFri 26 Feb 2021, 13:31
New tutorial questionTheCrowMon 15 Feb 2021, 08:12
Support iOS Emojis (and other platforms)LGforumSun 14 Feb 2021, 01:25
LGforum (2806)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
Mr.Easybb (1587)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
Bloodbath (745)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
Rukiafan (533)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
Dom (513)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
puppycheese (446)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
pedro (330)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
Neymar (301)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
Hitsu (281)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 
Flora (275)
Send a data into a web server Vote_lcapSend a data into a web server Voting_barSend a data into a web server Vote_rcap 


Send a data into a web server

HitsuHitsu
Status : Finished on working fmAPI.

Posts : 281
Join date : 2013-09-09
Age : 25
Location : Indonesia
Fri 10 Apr 2015, 13:07
Hello, is it possible to send a data into a web server? Because I need to. LOL.

Assume I have a form application in my forum, then if I click the 'Send Form' button, it will send the entered data into the server.. and if possible, echo-ing the data?

I know this is possible to do with AJAX, but I'm not sure if this is certainly possible.. I have my own server, so, no worries. Razz

An example of the form:

Code:
[panda=html]<input type="text" placeholder="Username">
<input type="textarea" placeholder="Your comments">
<input type="submit" value="Submit">

Code:
[panda=js]var button = document.getElementsByTagName('input')[2];
button.addEventListener('onclick', function() {
 $.post('/server.php', function() {
  console.log('Sending the data..');
 });
}

Something like that.
mangakamangaka
Status : What I'll type, I don't have any idea :/

Posts : 132
Join date : 2013-06-26
Location : Indonesia
Fri 10 Apr 2015, 13:16
I'm not that expert in JS and PHP.. but I think I can come up with a solution.

Code:
[panda=html]<form action="/server.php" method="POST">
<input type="text" placeholder="Username" name="username">
<input type="textarea" placeholder="Your comments" name="comments">
<input type="submit" value="Submit">
</form>

Code:
[panda=js]var button = document.getElementsByTagName('input')[2];
button.addEventListener('onclick', function() {
 $.post('/server.php', function() {
  console.log('Sending the data..');
 });
}

Code:
<?php
$uname = $_GET['username'];
$comment = $_GET['comments'];
echo 'Your username was $uname, and your comments was $comment';
?>

I'm just showing you the basics, I can't come up with the right solution because I'm a little stuck now. Maybe LG, Bloodbath, or another user can come up with a solution. Just a wild guess of mine. XD
HitsuHitsu
Status : Finished on working fmAPI.

Posts : 281
Join date : 2013-09-09
Age : 25
Location : Indonesia
Sat 11 Apr 2015, 07:18
Thank you!

When I click the submit button, it just won't work.. any help?
After using your PHP code, I'm using this code :

Code:
<?php
print_r($_POST);
?>

But it doesn't work.
avatarGuest
Mon 16 May 2016, 10:43
php hasn't been installed for FM sites and that is why it won't work.
Sponsored content