Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

contact form mobile site

  • 09-03-2012 5:48pm
    #1
    Registered Users, Registered Users 2 Posts: 210 ✭✭


    Dose any1 know how to do a contact form on a mobile site?

    I new it would not be the same as my pc site

    this is what i done but not working

    Html---

    <form id="contact_form" name="contact_form" method="post" action="send.php">

    <div data-role="fieldcontain">

    <label for="name">Name</label>
    <br />
    <input type="text" name="name" id="name" value="" />

    </div>

    <div data-role="fieldcontain">

    <label for="email">Email</label>
    <br />
    <input type="text" name="email" id="email" value="" />

    </div>

    <div data-role="fieldcontain">
    <label for="phone">Phone</label>
    <br />
    <input type="text" name="phone" id="phone" value="" />

    </div>

    <div data-role="fieldcontain">
    <label for="textarea">Message</label>
    <br />
    <textarea cols="40" rows="8" name="textarea" id="message"></textarea>

    </div>
    <input data-theme="b" data-icon="check" data-iconpos="right" value="Submit" type="submit" />

    </form>


    this is send.php


    [PHP]

    <?php

    error_reporting(E_ALL ^ E_NOTICE);

    $my_email = "info@mysite.com";



    $from_email = "";


    $continue = "/";


    $errors = array();


    if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}


    if(isset($_REQUEST) && !empty($_REQUEST))
    {

    $_REQUEST = trim($_REQUEST);

    if(substr_count($_REQUEST,"@) != 1 || stristr($_REQUEST, ") || stristr($_REQUEST,"\\") || stristr($_REQUEST,":")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@,$_REQUEST);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}

    }


    if(!(isset($_SERVER) && !empty($_SERVER) && stristr($_SERVER,$_SERVER))){$errors[] = "You must enable referrer logging to use the form";}


    function recursive_array_check_blank($element_value)
    {

    global $set;

    if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
    else
    {

    foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}

    }

    }

    recursive_array_check_blank($_REQUEST);

    if(!$set){$errors[] = "You cannot send a blank form";}

    unset($set);


    if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}

    if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}


    function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}

    $message = build_message($_REQUEST);

    $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Thank you for using FormToEmail from http://FormToEmail.com";

    $message = stripslashes($message);

    $subject = "FormToEmail Comments";

    $subject = stripslashes($subject);

    if($from_email)
    {

    $headers = "From: " . $from_email;
    $headers .= PHP_EOL;
    $headers .= "Reply-To: " . $_REQUEST;

    }
    else
    {

    $from_name = "";

    if(isset($_REQUEST) && !empty($_REQUEST)){$from_name = stripslashes($_REQUEST);}

    $headers = "From: {$from_name} <{$_REQUEST}>";

    }

    mail($my_email,$subject,$message,$headers);

    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>

    <head>
    <title>Form To Email PHP script from FormToEmail.com</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#ffffff" text="#000000">

    <div>
    <center>
    <b>Thank you <?php if(isset($_REQUEST)){print stripslashes($_REQUEST);} ?></b>
    <br>Your message has been sent
    <p><a href="<?php print $continue; ?>">Click here to continue</a></p>
    </center>
    </div>

    </body>
    </html>


    [/PHP]


Comments

  • Closed Accounts Posts: 34,809 ✭✭✭✭smash


    pjwhite99 wrote: »
    Dose any1 know how to do a contact form on a mobile site?

    I new it would not be the same as my pc site

    It's the exact same. It's still HTML so if it's not working then there has to be a problem with your php.


  • Registered Users, Registered Users 2 Posts: 210 ✭✭pjwhite99


    I dont know cause i have done this the same way as my contact page im getting error loading page when i press send


Advertisement