Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Ademola Adegbuyi
@ooade
@2Irina2 YWC :+1:
Dario Idrovo
@djidrovo1
who is good with PHP?
I need to know why my contact form is not working
:/
Ademola Adegbuyi
@ooade
@djidrovo1 show your code
Irina
@2Irina2
@marhyorh okay but how do i get the weather now? the problem is that i dont know how to call the api .. If i click on the examples on the site it keeps giving me errors..
Dario Idrovo
@djidrovo1
<?php 
$name = $_POST[name];
$email = $_POST[email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "djidrovo1@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
@marhyorh
this is my form
Ademola Adegbuyi
@ooade
@2Irina2 were you able to log out the longitude and latitude??
Irina
@2Irina2
the api responds with a json object and i dont know how to store it
Dario Idrovo
@djidrovo1
<form action="mail.php" method="POST">
          <p class="form-align">Name</p> <input type="text" name="name">
          <p class="form-align">Email</p> <input type="text" name="email">
          <p class="form-align">Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
          <input class="btn" type="submit" value="Send">
        </form>
Irina
@2Irina2
yeah i know how to get the lat and long now..
Ademola Adegbuyi
@ooade
@djidrovo1
$name = $_POST[name]; // should be $_POST['name']
$email = $_POST[email']; // should be $_POST['email'];
Irina
@2Irina2
This message was deleted
Ademola Adegbuyi
@ooade
@2Irina2 do you av an openweather API_KEY??
Irina
@2Irina2
and i saw this "api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}" and i know i am supposed to replace (lat) and {long} with the values i get from the ipinfo.io
yeah, i also got a key but i dont know how that is supposed to help me either
Trung Vo
@trunglive
hello guys, I just finished my first project Build a Tribute Page at http://codepen.io/trunglive/pen/bZxXNR/, I really appreciate your suggestion and feedback!
Dario Idrovo
@djidrovo1
@marhyorh I hade it with the ' but did not work
greg
@wearenotgroot
@2Irina2 put it as a url parameter
apiURL + '&appid=some numbers'
Dario Idrovo
@djidrovo1
@marhyorh here is my site
Irina
@2Irina2
@wearenotgroot i don't follow
Ademola Adegbuyi
@ooade
Dario Idrovo
@djidrovo1
@marhyorh this is what I get when i hit send
!
File not found (404 error)
If you think what you're looking for should be here, please contact the site owner.
Irina
@2Irina2
@marhyorh {"cod":"404","message":"Error: Not found city"}
Dario Idrovo
@djidrovo1
which is what my site is supposed to say when it hits a "missing" page
Ademola Adegbuyi
@ooade
@djidrovo1 do u av a mail.php??
@2Irina2 No, i expected you to pass a longitude and latitude in, like this http://api.openweathermap.org/data/2.5/weather?lat=10&lon=10&APPID=02c0da530b8cf7771cee190bae9256af
Dario Idrovo
@djidrovo1
@marhyorh no
Ademola Adegbuyi
@ooade
@2Irina2 Yeah, u re getting it, now handle the longitude and latitude variable with javascript, wrap it with $.getJSON
@djidrovo1 then you should remove the form action
Irina
@2Irina2
@marhyorh yeah but how do i store all the info given by this link? var weather = http://api.openweathermap.org/data/2.5/weather?lat=44.1833&lon=28.6500&APPID=433e5ac19c344d585ded5fba77c92ded" ?
greg
@wearenotgroot
@2Irina2 remember getJSON are asynchronous so you need to call the getJSON for the openweather inside the callback function of your getJSON for ipinfo
@2Irina2 you need to replace those lat and lon numbers with variables.
@2Irina2 the lat and lon values will come from the object in the result of your getJSON (ipinfo)
Irina
@2Irina2
@wearenotgroot oh yeah, i am aware of the fact that lat and lon should be variables.. they depend on the position of the user... but for now, i need to understand how to gather the data from the openweathermap api
@wearenotgroot for now, suppose i am the only user of this app and i am just using my lat and long just to understand how the weather api works
greg
@wearenotgroot
@2Irina2 well build the api request first then console log the data to study it or look at the example on the api doc on expected data(same thing you did in the ipinfo)
Ademola Adegbuyi
@ooade
@2Irina2 in your $.JSON, you can pass in a function and pass these parameters to it
@djidrovo1
<?php 
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "djidrovo1@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
if (mail($recipient, $subject, $formcontent, $mailheader)) {
    echo "Thank you!";
} else {
   echo "Error Occured";
}
?>

<form action="#" method="POST">
          <p class="form-align">Name</p> <input type="text" name="name">
          <p class="form-align">Email</p> <input type="text" name="email">
          <p class="form-align">Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
          <input class="btn" type="submit" value="Send">
</form>
Juan Moraza
@Morazajuan
how where should i add the toggle method in my code?
 $(window).load(function(){
    $('.tempf').hide();
});
$('.tempf,.tempc').click(function(){
    $('.tempf,.tempc').toggle();
});
thats what i been trying to put but doesnt work
Ademola Adegbuyi
@ooade
@2Irina2 you can have something like this
$.getJSON("http://ipinfo.io", function(data){
          data = { name: data.city + " " +  data.country, coords: {
            latitude: data.loc.split(',')[0], longitude: data.loc.split(',')[1]
          }}
          showPosition(data);
        })

function showPosition(position) {
    var latitude = position.coords.latitude;
    var longitude = position.coords.longitude;
    $.getJSON("http://api.openweathermap.org/data/2.5/weather?lat="+latitude+"&amp;lon="+longitude+"&APPID=02c0da530b8cf7771cee190bae9256af",function(data){
      var city = data.name;
      var temp = data.main.temp;
.... //and so on
Irina
@2Irina2
@marhyorh @wearenotgroot okay i think i am getting close.. please check what i did so far