📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

PHP Form?

13»

Comments

  • JOel_2
    JOel_2 Posts: 122 Forumite
    Any reason for not using HTML forms, and passing the data into PHP.
    <?php
    
    if ($_GET['action'] == "bus_sub")!!
    
    $to = "enquiries&#64;onethoughtpgd.co.uk";
    
    $subject = "Business Directory Listing";
    $email = $_POST['email'] ;
    $message = $_POST['message'] ;
    $busname = $_POST['business_name'];
    $cat = $_POST['category'];
    $phone = $_POST['phone_number'];
    $web = $_POST['website'];
    $contact = $_POST['contact'] ;
    
    $str_message = "Contact Name: " . $contact . "\n\n" . "Message: " . $message . "\n\n" . "Business Name: " . $busname . "\n\n" . "Category: " . $cat . "\n\n" . "Phone: " . $Phone . "\n\n" . "Email: " . $email;
    
    $sent = mail($to, $subject, $str_message);
        if($sent)
            !!
            print "Your mail was sent successfully, please allow 2-3 working days for your information to be placed on the site."; 
            }
        else
            !!
            print "We encountered an error sending your mail";
            }
    } else !!
    ?>
    
    <form method="post" action="contactbusiness.php?action=bus_sub">
    <p align="left">
    Your Name: <input type=text name="business_name" /><br />
    Message: <textarea name="message" rows="10" cols="25"></textarea><br />
    <br><br />
    Business Name: <input type=text name="business_name" /><br />
    <br>
    Category: <input type=text name="category" /><br />
    <br />
    Phone Number: <input type=text name="phone" /><br />
    <br />
    Email: <input type=text name="email" /><br />
    <br />
    Website:<input type=text name="website" /><br />
    </p>
    <input type="submit" value="submit">
    </p>
    </form>
    <?
    }
    ?>
    
    

    Works, just needs tarting up. Name it contactbusiness.php and your away.

    Joel
    FreeBSD | Microsoft | Linux Nerd
    GNU-PG Key-ID: 0xCBC2F26D
    BSc MBCS MCP
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 351.3K Banking & Borrowing
  • 253.2K Reduce Debt & Boost Income
  • 453.8K Spending & Discounts
  • 244.3K Work, Benefits & Business
  • 599.5K Mortgages, Homes & Bills
  • 177.1K Life & Family
  • 257.8K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.2K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.