10 Replies - 3114 Views - Last Post: 13 July 2012 - 07:48 PM

#1 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Get input and send it by mail

Posted 12 July 2012 - 01:01 PM

Hi.

I have created some forms where users can type in values. What I am looking for now, is a way to get all this user data, and send them to an email adress. What I am talking about can be seen on qitoz.net
So far I haven't found a solution by googleling this issue, but someting tells me that I am searching on the wrong keywords. I am creating this for somebody who has his homepage made in wordpress, which means that the back-end code is php. But to get the data that the user provides on qitoz.net, doesn't require php, does it?

Suggestions, tips or some nice links are appreciated.
thanks

Another thing is... If you open this url (qitoz.net) in IE, you will see that the first checkbox looks weird, as if it is disabled. This only happens in IE. Is there any fix for this?

Last thing. Some of you might also notice that this page doesn't scale right if you use Ipad or a mobile phone. I have tried to correct this, but without luck. Normally this issue is due to improper use of css style like absolute positions etc, but I havent used that. I am not expecting people to be able to see the problem here without seeing the html code, but you never know... Maybe there are some html gosu's out there who know all about this stuff.

Is This A Good Question/Topic? 0
  • +

Replies To: Get input and send it by mail

#2 exiles.prx  Icon User is offline

  • D.I.C Head

Reputation: 65
  • View blog
  • Posts: 241
  • Joined: 22-November 10

Re: Get input and send it by mail

Posted 12 July 2012 - 05:07 PM

You could add the event onclick() to the submit button, once a user clicks submit get the form values using javascript. You will then have to use ajax to send the data gathered from the form to a script which sends the email.
Was This Post Helpful? 1
  • +
  • -

#3 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Re: Get input and send it by mail

Posted 13 July 2012 - 03:12 AM

View Postexiles.prx, on 12 July 2012 - 05:07 PM, said:

You could add the event onclick() to the submit button, once a user clicks submit get the form values using javascript. You will then have to use ajax to send the data gathered from the form to a script which sends the email.

I know about adding the event listeners to the buttons (In this case an image). But don't I have to express in code how to get the user input from fields? Do you know where I can find ajax examples of what you suggested?
Was This Post Helpful? 0
  • +
  • -

#4 exiles.prx  Icon User is offline

  • D.I.C Head

Reputation: 65
  • View blog
  • Posts: 241
  • Joined: 22-November 10

Re: Get input and send it by mail

Posted 13 July 2012 - 06:01 AM

View PostIamTw_, on 13 July 2012 - 03:12 AM, said:

But don't I have to express in code how to get the user input from fields?


Yes, you could use plain javascript or jquery like so:

document.getElementById('first_name').value;

$('#first_name').val();


View PostIamTw_, on 13 July 2012 - 03:12 AM, said:

Do you know where I can find ajax examples of what you suggested?


Javascript example.
jWQuery documentation and examples.

I didn't include any PHP examples to send an email, but you can find many examples by searching for PHPs 'mail' function.

This post has been edited by exiles.prx: 13 July 2012 - 06:10 AM

Was This Post Helpful? 1
  • +
  • -

#5 el_pancho  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 88
  • Joined: 26-April 12

Re: Get input and send it by mail

Posted 13 July 2012 - 10:41 AM

Hi there,

First part: sending information, i would prefer to use a form with javascript something like this:


<form method='' action='' onsubmit='myjavascriptfunction(firstinput.value); return false;'>
    <input type='text' name='firstinput'></input>
    <input type='submit' value='Send'></input>

</form>



my javascript function is: myjavascriptfunction(variable);
my input´s name is: firstinput,

now you can see that the form onsubmit sends the nameofmyinput.value: (dot)(value) .value means the current value that it has;
after the function there is a return false; this return makes my form not refresh the page after triggering the submit button.

for the IE css errors, you should define de doctype first in your pages, example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



this will solve many IE css erros.
Was This Post Helpful? 1
  • +
  • -

#6 exiles.prx  Icon User is offline

  • D.I.C Head

Reputation: 65
  • View blog
  • Posts: 241
  • Joined: 22-November 10

Re: Get input and send it by mail

Posted 13 July 2012 - 11:01 AM

Quote

Last thing. Some of you might also notice that this page doesn't scale right if you use Ipad or a mobile phone.


Try adding the viewport meta tag, ex:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">


After adding this tag, your page should scale correctly on mobile devices. If it does not, then the issue may have to due with your CSS.
Was This Post Helpful? 0
  • +
  • -

#7 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Re: Get input and send it by mail

Posted 13 July 2012 - 02:07 PM

Thanks for the replies guys.

I have found this example, and php code
<?
    //change this to your email.
    $to = "m@maaking.com";
    $from = "m2@maaking.com";
    $subject = "Hello! This is HTML email";

    //begin of HTML message
    $message = <<<EOF
<html>
  <body bgcolor="#DCEEFC">
    <center>
        <b>Looool!!! I am reciving HTML email......</b> <br>
        <font color="red">Thanks Mohammed!</font> <br>
        <a href="http://www.maaking.com/">* maaking.com</a>
    </center>
      <br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine
  </body>
</html>
EOF;
   //end of message
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";

    //options to send to cc+bcc
    //$headers .= "Cc: [email]maa@p-i-s.cXom[/email]";
    //$headers .= "Bcc: [email]email@maaking.cXom[/email]";
    
    // now lets send the email.
    mail($to, $subject, $message, $headers);

    echo "Message has been sent....!";
?> 


I reference to this file as the action in my form.
The tutorial of the above code just says "copy this code and remember to change the email address to your own". But where do I place this code? I create a folder on the server, or where must it go?
Was This Post Helpful? 0
  • +
  • -

#8 calvinthedestroyer  Icon User is offline

  • D.I.C Lover

Reputation: 167
  • View blog
  • Posts: 1,911
  • Joined: 13-October 07

Re: Get input and send it by mail

Posted 13 July 2012 - 02:49 PM

Isn't there a way to detect what browsers the visitor is using and then redirect them to a compatible index page?

I have seen some web pages yell at me for using an old browser.
Was This Post Helpful? 0
  • +
  • -

#9 IamTw_  Icon User is offline

  • D.I.C Head

Reputation: 32
  • View blog
  • Posts: 238
  • Joined: 25-February 11

Re: Get input and send it by mail

Posted 13 July 2012 - 03:14 PM

View Postcalvinthedestroyer, on 13 July 2012 - 02:49 PM, said:

Isn't there a way to detect what browsers the visitor is using and then redirect them to a compatible index page?

I have seen some web pages yell at me for using an old browser.

Hi. Was this an answer to anything? I'm a little lost
Was This Post Helpful? 0
  • +
  • -

#10 calvinthedestroyer  Icon User is offline

  • D.I.C Lover

Reputation: 167
  • View blog
  • Posts: 1,911
  • Joined: 13-October 07

Re: Get input and send it by mail

Posted 13 July 2012 - 03:40 PM

View PostIamTw_, on 13 July 2012 - 04:14 PM, said:

View Postcalvinthedestroyer, on 13 July 2012 - 02:49 PM, said:

Isn't there a way to detect what browsers the visitor is using and then redirect them to a compatible index page?

I have seen some web pages yell at me for using an old browser.

Hi. Was this an answer to anything? I'm a little lost


Yes it was referring to your issue with IE. Since your site won't display correctly in IE, you can make an alternate index page for IE and redirect IE users to that index page.

View PostIamTw_, on 12 July 2012 - 02:01 PM, said:

Another thing is... If you open this url (qitoz.net) in IE, you will see that the first checkbox looks weird, as if it is disabled. This only happens in IE. Is there any fix for this?

Was This Post Helpful? 1
  • +
  • -

#11 exiles.prx  Icon User is offline

  • D.I.C Head

Reputation: 65
  • View blog
  • Posts: 241
  • Joined: 22-November 10

Re: Get input and send it by mail

Posted 13 July 2012 - 07:48 PM

View PostIamTw_, on 13 July 2012 - 02:07 PM, said:

Thanks for the replies guys.

I have found this example, and php code
<?
    //change this to your email.
    $to = "m@maaking.com";
    $from = "m2@maaking.com";
    $subject = "Hello! This is HTML email";

    //begin of HTML message
    $message = <<<EOF
<html>
  <body bgcolor="#DCEEFC">
    <center>
        <b>Looool!!! I am reciving HTML email......</b> <br>
        <font color="red">Thanks Mohammed!</font> <br>
        <a href="http://www.maaking.com/">* maaking.com</a>
    </center>
      <br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine
  </body>
</html>
EOF;
   //end of message
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";

    //options to send to cc+bcc
    //$headers .= "Cc: [email]maa@p-i-s.cXom[/email]";
    //$headers .= "Bcc: [email]email@maaking.cXom[/email]";
    
    // now lets send the email.
    mail($to, $subject, $message, $headers);

    echo "Message has been sent....!";
?> 


I reference to this file as the action in my form.
The tutorial of the above code just says "copy this code and remember to change the email address to your own". But where do I place this code? I create a folder on the server, or where must it go?


@IamTw_: Is the server using vhost entries? If not the you will have to put the file in the htdocs folder. If the server is using vhosts then you can create an entry and set the directory to point to the correct location. Many tutorials can be found online for either method.



Quote

Isn't there a way to detect what browsers the visitor is using and then redirect them to a compatible index page?

I have seen some web pages yell at me for using an old browser.


@calvinthedestroyer: instead of redirecting to a different index page, I think swapping out the CSS file for a more IE compatible CSS file would make more sense. Unless of course the raw HTML is causing issues with IE.

This post has been edited by exiles.prx: 14 July 2012 - 01:36 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1