Php form error?

Hi. I've got php form from one of the templates but it doesn't work. Can anyone see an error?
The code:
<div id="content_item">
          <h1>Contact Us</h1>
          <p>Say hello, using this contact form.</p>
          <?php
            // Set-up these 3 parameters
            // 1. Enter the email address you would like the enquiry sent to
            // 2. Enter the subject of the email you will receive, when someone contacts you
            // 3. Enter the text that you would like the user to see once they submit the contact form
            $to = [email protected];
            $subject = Enquiry from the website;
            $contact_submitted = Your message has been sent.;
            // Do not amend anything below here, unless you know PHP
            function email_is_valid($email) {
              return preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',$email);
            if (!email_is_valid($to)) {
              echo '<p style="color: red;">You must set-up a valid (to) email address before this contact page will work.</p>';
            if (isset($_POST['contact_submitted'])) {
              $return = "\r";
              $youremail = trim(htmlspecialchars($_POST['your_email']));
              $yourname = stripslashes(strip_tags($_POST['your_name']));
              $yourmessage = stripslashes(strip_tags($_POST['your_message']));
              $contact_name = "Name: ".$yourname;
              $message_text = "Message: ".$yourmessage;
              $user_answer = trim(htmlspecialchars($_POST['user_answer']));
              $answer = trim(htmlspecialchars($_POST['answer']));
              $message = $contact_name . $return . $message_text;
              $headers = "From: ".$youremail;
              if (email_is_valid($youremail) && !eregi("\r",$youremail) && !eregi("\n",$youremail) && $yourname != "" && $yourmessage != "" && substr(md5($user_answer),5,10) === $answer) {
                mail($to,$subject,$message,$headers);
                $yourname = '';
                $youremail = '';
                $yourmessage = '';
                echo '<p style="color: blue;">'.$contact_submitted.'</p>';
              else echo '<p style="color: red;">Please enter your name, a valid email address, your message and the answer to the simple maths question before sending your message.</p>';
            $number_1 = rand(1, 9);
            $number_2 = rand(1, 9);
            $answer = substr(md5($number_1+$number_2),5,10);
          ?>
          <form id="contact" action="contact.php" method="post">
            <div class="form_settings">
              <p><span>Name</span><input class="contact" type="text" name="your_name" value="<?php echo $yourname; ?>" /></p>
              <p><span>Email Address</span><input class="contact" type="text" name="your_email" value="<?php echo $youremail; ?>" /></p>
              <p><span>Message</span><textarea class="contact textarea" rows="5" cols="50" name="your_message"><?php echo $yourmessage; ?></textarea></p>
              <p style="line-height: 1.7em;">To help prevent spam, please enter the answer to this question:</p>
              <p><span><?php echo $number_1; ?> + <?php echo $number_2; ?> = ?</span><input type="text" name="user_answer" /><input type="hidden" name="answer" value="<?php echo $answer; ?>" /></p>
              <p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="send" /></p>
            </div>
          </form>
        </div>

The only error I see is your text strings which are assigned to the php variables should be enclosed in "  " like below: (best not to post real email addresses as it attracts spam)
$to = "[email protected]";
            $subject = "Enquiry from the website";
            $contact_submitted = "Your message has been sent.";
Plus change the $return variable to a line break (as below) otherwise the information will come through in one continuous line.
$return = "\n\n";

Similar Messages

  • ActionScript 3 + PHP: TypeError: Error #2007: Parameter text must be non-null.

    Hi - Still new to flash as3 and php -
    it is a contact form page - user puts in information - i am to receive it in an email address their information
    as well the variables get sent back from the php to the .swf file.
    I am receiving these errors and not knowing how to fix them.
    any help would be much appreciated. thank you in advance really.
    below are the errors in flash - as3 code - and php code setup.
    errors:
    ActionScript 3 + PHP: TypeError: Error #2007: Parameter text must be non-null:
      at flash.text::TextField/set text()
              at kwangjaekim_fla::wholeform_16/completeHandler()
              at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
              at flash.events::EventDispatcher/dispatchEvent()
              at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    my as3 code is the following:
    // build variable name for the URL Variables loader
    var variables:URLVariables = new URLVariables();
    //Build the varSend variable
    var varSend:URLRequest = new URLRequest("contact_parse.php");
    varSend.method = URLRequestMethod.POST;
    varSend.data = variables;
    //Build the varLoader variable
    var varLoader:URLLoader = new URLLoader;
    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader.addEventListener(Event.COMPLETE, completeHandler);
    //handler for the PHP  script completion and return of status
    function completeHandler(event:Event):void{
              //value is cleared at ""
              name_txt.text = "";
              contact_txt.text = "";
              msg_txt.text = "";
              //Load the response PHP here
              status_txt.text = event.target.data.return_msg;
    //Add event listener for submit button click
    submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
    //function ValidateAndSend
    function ValidateAndSend(event:MouseEvent):void{
              //validate fields
              if(!name_txt.length){
                        status_txt.text = "Please Enter Your Name";
              }else if(!contact_txt.length){
                        status_txt.text = "Please Enter Your Contact Detail";
              }else if(!msg_txt.length){
                        status_txt.text = "Please Enter Your Message";
              }else {
              // ready the variables in form for sending
      variables.userName = name_txt.text;
              variables.userContact = contact_txt.text;
              variables.userMsg = msg_txt.text;
              // Send the data to PHP now
    varLoader.load(varSend);
    submit_btn.addEventListener(MouseEvent.CLICK, function(){MovieClip(parent).gotoAndPlay(151)});
              } // Close else condition for error handling
    } // Close validate and send function
    my php code is the following:
    <?php
    // Create local PHP variables from the info the user gave in the Flash form
    $senderName   = $_POST['userName'];
    $senderEmail     = $_POST['userContact'];
    $senderMessage = $_POST['userMsg'];
    // Strip slashes on the Local variables
    $senderName   = stripslashes($senderName);
    $senderContact     = stripslashes($senderContact);
    $senderMessage   = stripslashes($senderMessage);
    //!!!!!!!!!!!!!!!!!!!!!!!!!     change this to my email address     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                              $to = "put iny me email address";
         // Place sender Email address here
        $from = "$senderContact ";
        $subject = "Contact from your site";
        //Begin HTML Email Message
        $message = <<<EOF
    <html>
      <body bgcolor="#FFFFFF">
    <b>Name</b> = $senderName<br /><br />
    <b>Contact</b> = <a href="mailto:$senderContact">$senderEmail</a><br /><br />
    <b>Message</b> = $senderMessage<br />
      </body>
    </html>
    EOF;
       //end of message
        $headers  = "From: $from\r\n";
        $headers .= "Content-type: text/html\r\n";
        $to = "$to";
        mail($to, $subject, $message, $headers);
    exit();
    ?>
    thank you once again
    jay

    thank you Ned -
    i put in the trace line as you mentioned -
    and this is what i received -
    returns: undefined
    TypeError: Error #2007: Parameter text must be non-null
              at flash.text::TextField/set text()
              at kwangjaekim_fla::wholeform_16/completeHandler()
              at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
              at flash.events::EventDispatcher/dispatchEvent()
              at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    what does this mean exactly?
    thank you for the help really

  • Can you auto-attach files in a PHP form?

    Hi there,
    Have been looking over everywhere for a solution to my problem. I am going to try and be as clear as I can about the problem.
    I have had some experience making simple PHP forms that let the user put their name, email, subject and body text and send it in an email using the form.
    But for a project I am currently undertaking - the client has requested a form that will pre-attach a particular document to the email when it is sent. All the user has to do is input the email address of the adressee and their name/email address and all the other fields are custom made (i.e. subject, body text) - and the email will be sent to the selected recepient with the file already attached.
    I was envisaging the PHP script would collect the reference for a file that is already sitting on the web server and attach it in the function.
    Is there anyway to do this? Because if it isn't I may as well tell the client to go and use outlook - because the web form will really have no purpose.
    Thanks in advance

    Hi have proceeded along the path of inserting links
    into PHP generated email but I am having trouble in outputting the body message in HTML - All I get out
    in the output email is the HTML tags with the text (plain text).
    Did some research and found out that I have to determine the content type/charset.
    I have tried to do this in my PHP but to no avail. Also I am not getting the email or name of the sender in the email that is generated....
    Anyway, there is the PHP code (and it's not that tight but it works):
    AND SOME DEFAULT TEXT THAT WILL CONTAIN LINKS TO NECESSARY FILES TO DOWNLOAD:
    link to PDF '.$field_message; $headers = 'From: '.$cf_yremail."\r\n"; $headers .= 'Reply-To: '.$cf_yremail."\r\n"; /* If your e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $mail_to)) { ?>
    Any help on this would be much appreciated....
    Thanks

  • Code issue in php form - submit button not sending email

    Created a form that was originally supposed to open up to 2 pages depending on what was clicked. Clear would send you to an error page, and submit would send you to a thank you page. Decided that was a waste and so did not create the html pages. BUT, wanted the form info for the contact page.
    Here is the issue: it will not submit when submit is clicked. It clears when you click clear, but there's no email coming from the site via submit.
    Do I need to edit the php form code if I don't want the other pages? I've looked at what I have but I don't see if there is a form error or anything here. Here is the code for anyone who wants to have a look. Thanks in advance.
    <?php
    // get posted data into local variables
    $EmailFrom = "EMAIL FROM WEP PAGE - CONTACT - ";
    $EmailTo = "[email protected]";
    $Subject = "EMAIL FROM jennylowhar.com - CONTACT -";
    $name = Trim(stripslashes($_POST['name']));
    $telephone = Trim(stripslashes($_POST['telephone']));
    $email = Trim(stripslashes($_POST['email']));
    $comments = Trim(stripslashes($_POST['comments']));
    // validation
    $validationOK=true;
    if (Trim($name)=="") $validationOK=false;
    if (Trim($email)=="") $validationOK=false;
    if (!$validationOK) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
      exit;
    // prepare email body text
    $Body = "";
    $Body .= "name: ";
    $Body .= $name;
    $Body .= "\n";
    $Body .= "telephone: ";
    $Body .= $telephone;
    $Body .= "\n";
    $Body .= "email: ";
    $Body .= $email;
    $Body .= "\n";
    $Body .= "comments: ";
    $Body .= $comments;
    $Body .= "\n";
    // send email
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
    // redirect to success page
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.html\">";
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.php\">";
    ?>

    I'm confused by that, but I know this works.
    $fname=STRIPSLASHES($_POST['fname']);
    $lname=STRIPSLASHES($_POST['lname']);
    $title=STRIPSLASHES($_POST['title']);
    $company=STRIPSLASHES($_POST['company']);
    $street=STRIPSLASHES($_POST['street']);
    $town=STRIPSLASHES($_POST['town']);
    $zip=STRIPSLASHES($_POST['zip']);
    $phone=STRIPSLASHES($_POST['phone']);
    $fax=STRIPSLASHES($_POST['fax']);
    $county=STRIPSLASHES($_POST['county']);
    $phone=STRIPSLASHES($_POST['phone']);
    $email=STRIPSLASHES($_POST['email']);
    $comments=STRIPSLASHES($_POST['comments']);
    $date=STRIPSLASHES($_POST['date']);
    $time=STRIPSLASHES($_POST['time']);
    $location=STRIPSLASHES($_POST['location']);
    $from="$email";
    $to="putemailhere";
    $subject="Submission from Contact Form";
    $msg= "This is a submission from yoururl.com.\n\n"
    . "Clients Name: $fname . $lname \n"
    . "Title: $title\n"
    . "Company Name: $company\n"
    . "Street Address: $street\n"
    . "Town:$town\n"
    . "Zip: $zip\n"
    . "Telephone: $phone\n"
    . "Email Address: $email\n"
    . "Comments: $comments\n";
    mail($to, $subject, $msg, 'From:' .$from);
    PS, go back and edit your origial post and REMOVE your email.
    Gary

  • PHP Form mail

    I used this script
    http://www.visibilityinherit.com/code/php-form-validation.php
    to produce a form and everything worked fine on my site, which I
    was using for testing. When I transferred over to the client's site
    it doesn't send the email. The error and thank you messages work,
    but no email. As I have heard that some hosts block some php files
    with the name 'formmail' I called it something else.
    I have checked and rechecked all the data and only my email
    address and the URLs for the error and thank you pages had to be
    changed, my email is correct, but still not email.
    Any ideas as to what is happening and how I can get around it
    please?
    Rosalind

    I have been sent the following information and code, but have
    not succeeded in working out where to add it. The code I am using
    is underneath. Many thanks
    - to send emails through our servers you must comply with one
    of the following rules
    a. The sending email must be from your domain
    b. The receiving email must be from your domain
    This account could/should be [email protected]
    - To avoid a wrong use of our scripts by spammers you must
    had a line before you call the “mail” functionality
    ini_set("sendmail_from", " [email protected] ");
    - Please add to the email send code a functionality
    “-f” in the fifth parameter of the function send mail
    - This is the simple configuration of sending emails in php
    <?php
    ini_set("sendmail_from", [email protected]);
    mail($email_to, $email_subject, $email_message, $headers,
    '-f'[email protected]);
    ?>
    my php code is
    <?php
    // Input Your Personal Information Here
    $mailto = '[email protected]' ;
    $from = "FormosaParadise.com" ;
    $formurl = "
    http://formosaparadise.com/correios.php"
    $errorurl = "
    http://formosaparadise.com/formmailerror.php"
    $thankyouurl = "
    http://formosaparadise.com/thankyou.php"
    // End Edit
    // prevent browser cache
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "
    GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    function remove_headers($string) {
    $headers = array(
    "/to\:/i",
    "/from\:/i",
    "/bcc\:/i",
    "/cc\:/i",
    "/Content\-Transfer\-Encoding\:/i",
    "/Content\-Type\:/i",
    "/Mime\-Version\:/i"
    if (preg_replace($headers, '', $string) == $string) {
    return $string;
    } else {
    die('You think Im spammy? Spammy how? Spammy like a clown,
    spammy?');
    $uself = 0;
    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" :
    "\n" ;
    if (!isset($_POST['email'])) {
    header( "Location: $errorurl" );
    exit ;
    // Input Your Personal Information Here
    $name = remove_headers($_POST['name']);
    $email = remove_headers($_POST['email']);
    $phone = remove_headers($_POST['phone']);
    $comments = remove_headers($_POST['comments']);
    $http_referrer = getenv( "HTTP_REFERER" );
    // End Edit
    if
    (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i",$email))
    header( "Location: $errorurl" );
    exit ;
    // Input Your Personal Information Here
    if (empty($name) || empty($email) || empty($phone)
    ||empty($comments)) {
    header( "Location: $errorurl" );
    exit ;
    // End Edit
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
    if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
    // sets max amount of characters in comments area (edit as
    nesesary)
    if (strlen($comments) > 1250) {
    $comments=substr($comments, 0, 1250).'...';
    // End Edit
    $message =
    "This message was sent from:\n" .
    "$http_referrer\n\n" .
    // Input Your Personal Information Here
    "Name: $name\n\n" .
    "Email: $email\n\n" .
    "Phone No: $phone\n\n" .
    "Comments: $comments\n\n" .
    "\n\n------------------------------------------------------------\n"
    // End Edit
    mail($mailto, $from, $message,
    "From: \"$name\" <$email>" . $headersep . "Reply-To:
    \"$name\" <$email>" . $headersep );
    header( "Location: $thankyouurl" );
    exit ;
    ?>

  • Php form processing script

    Hi. I got a program to write a php form processing script. My submit form is for photo submission to my domain email. I published to site and did a test to see if it works i got this error:
    Warning: require_once(F:\Domains\mydomain\mydomain.com\wwwroot/includes/Upload_Photos-lib.php): failed to open stream: No such file or directory in F:\Domains\mydomain\mydomain.com\wwwroot\Upload_Photos.php on line 24 Fatal error: require_once(): Failed opening required 'F:\Domains\mydomain\mydomain.com\wwwroot/includes/Upload_Photos-lib.php' (include_path='.;C:\php\pear') in F:\Domains\mydomain\mydomain.com\wwwroot\Upload_Photos.php on line 24
    What does this mean? How can i solve this so that i can process my form?

    See if the below form helps: You need to create a folder on your server named - upload - this is where any files uploaded will be stored (make sure the folder is writable. Also change the email address where the information that someone who has uploaded a file will go to. Look for the following in the code: $to ="XXXXXXXXXXXX.com";
    <!DOCTYPE html>
    <head>
    <meta charset="UTF-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    #wrapper {
    width: 400px;
    margin: 0 auto;
    </style>
    </head>
    <body>
    <div id="wrapper">
    <?php if(isset($_POST['submit'])) {
    $name = trim($_POST['name']);
    if(empty($name)) {
    $error['name'] = "Please provide your name";
    $location = trim($_POST['location']);
    if(empty($location)) {
    $error['location'] = "Please provide your location";
    $email = trim($_POST['email']);
    if(empty($email)) {
    $error['email'] = "Please provide your email";
    $category_description = trim($_POST['category_description']);
    if(empty($category_description)) {
    $error['category_description'] = "Please provide the category or description";
    $terms_conditions = trim($_POST['terms_conditions']);
    if(empty($terms_conditions)) {
    $error['terms_conditions'] = "Please accept the terms & conditions";
    $allowedExts = array(
       "doc",
      "docx",
            "rtf",
            "txt",
            "pdf",
            "jpeg",
            "jpg",
    $allowedMimeTypes = array(
      'application/msword',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'application/rtf',
            'application/x-rtf',
            'text/richtext',
            'text/rtf',
            'application/plain',
      'application/pdf',
      'image/gif',
      'image/jpeg',
    $extension = end(explode(".", $_FILES["file"]["name"]));
    if (empty($_FILES["file"]["name"])) {
        $selectFile = 'Please select a file to upload';
    elseif ( ! ( in_array($extension, $allowedExts ) ) ) {
      $fileTypeNotAllowed = 'File type not allowed';
    elseif ($_FILES["file"]["size"] > 2097152) {
      $fileTooLarge = 'Please provide a smaller file';
    elseif (file_exists("upload/" . $_FILES["file"]["name"])) {
    $fileExists = $_FILES["file"]["name"] . " already exists, Please change the file name ";
    elseif (in_array( $_FILES["file"]["type"], $allowedMimeTypes ) )
        if(!empty($_POST['terms_conditions'])) {
    move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
        $fileName = $_FILES["file"]["name"];
        $fileUploadSuccessful = 'File uploaded successfully';
    $to = "XXXXXXXXXXXXX.com";
    $subject   = "Upload to website";
    $headers  = "From: $email\r\n";
    $headers .= "Reply-To: $email\r\n";
    $message = "Name: $name\n\n";
    $message .= "Location: $location\n\n";
    $message .= "Email Address: $email\n\n";
    $message .= "Category/Description: $category_description\n\n";
    $message .= "File: $fileName\n\n";
    mail($to, $subject, $message, $headers);
    $sent = "Mail was sent successfully";
    ?>
    <h1>Form</h1>
    <?php
    foreach ($error as $value) {
        echo "<p>".$value."</p>";
    if(isset($formFieldError)) {
    echo "<p>".$formFieldError."</p>";
    if(isset($selectFile)) {
    echo "<p>".$selectFile."</p>";
    if(isset($fileTypeNotAllowed)) {
    echo "<p>".$fileTypeNotAllowed."</p>";
    if(isset($fileTooLarge)) {
    echo "<p>".$fileTooLarge."</p>";
    if(isset($fileExists)) {
    echo "<p>".$fileExists."</p>";
    if(isset($fileUploadSuccessful)) {
    echo "<p>".$fileUploadSuccessful."</p>";
    ?>
    <form action="upload_file.php" method="post"
    enctype="multipart/form-data">
    <p>
    <label for="name">Name<br>
    <input type="text" name="name" id="name" value="<?php if(isset($name)) {echo $name; }  ?>"/>
    </label>
    </p>
    <p>
    <label for="location">Location<br>
    <input type="text" name="location" id="location" value="<?php if(isset($location)) {echo $location; }  ?>"/>
    </label>
    </p>
    <p>
    <label for="email">Email<br>
    <input type="text" name="email" id="email" value="<?php if(isset($email)) {echo $email; }  ?>" />
    </label>
    </p>
    <p>
    <label for="category_description">Category and Description<br>
    <input type="text" name="category_description" id="category_description" value="<?php if(isset($category_description)) {echo $category_description; }  ?>" />
    </label>
    </p>
    <p>
    <label for="file">File Attachment:<br>
    <input type="file" name="file" id="file" />
    </label>
    </p>
    <p>
    <label for="terms_conditions">Terms & Conditions:
    <input name="terms_conditions" type="checkbox" value="accept" <?php if(isset($_POST['terms_conditions'])) {echo "checked"; }  ?>> (Please check)
    </label>
    </p>
    <input type="submit" name="submit" value="Submit" />
    </form>
    </div>
    </body>
    </html>

  • PHP Form Redirect without Header function

    I need help with a PHP form that needs to redirect to a thankyou page upon sending. I have tried the header function but it doesnt work because i have multiple PHP references throughout the page that prevent the header function from working. Is there another way to redirect once the email sends? I am leaving out the rest of the form and functions but this is what i have currently that affects the message sending:
    In form page requestquote.php:
    <? include('sendemail.php'); if($cmsg) echo"<h1>".$cmsg."</h1>"; else { ?>
    In sendemail.php:
    mail($recipient, $subject, $formcontent, $mailheader) or die("There was an error in your request. Please go back and try again.");
    $cmsg="Thank for you requesting a quote. A Blue Grace Representative will contact you shortly." ;
    Thanks,
    Ben

    I need the thankyou page for conversion tracking on the website, which cant be done with a simple message. Thats what i have currently in the form.
    If i put the code in the form action area, will it redirect only upon sending? I want to make sure it goes through the process of validating all the fields and sending the email before it redirects.
    Thanks,
    Ben

  • Re: Insert data into oracle database using a PHP form

    Hai its different for me, i want to display a data based on the input from php form. I see and trying your script but it didn't work.
    <?php
    // just print form asking for name if none was entered
    if( !isset($query)) {
    echo "<form action=\"$uri\" method=post>\n";
    echo "<p>Enter Name: ";
    echo "<input type=text size=100 maxlength=200 name=data value=\"$data\">\n";
    echo "<br><input type=submit name=submit value=Submit>\n";
    echo "</form>\n";
    exit;
    $data=$_POST;
    stripslashes($data);
    // Select statement
    $query = "SELECT * FROM animal WHERE skin=$data";
    // connect to Oracle
    $username = "xxxxxx";
    $paswd = "xxxxxx";
    $dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
    "(HOST=yyyyyyyy)(PORT=1521))".
    "(CONNECT_DATA=(SID=COSC)))";
    $db_conn = ocilogon($username, $paswd, $dbstring);
    //$stmt = OCIParse($db_conn, $query);
    //OCIExecute($stmt, OCI_DEFAULT);
    //OCIFreeStatement($stmt);
    //OCILogoff($db_conn);
    $stmt = OCIParse ($db_conn, $sql);
    OCIBindByName ($stmt, ":name", &$data, -1);
    OCIExecute ($stmt);
    OCIFreeStatement($stmt);
    OCILogoff ($db_conn);
    ?>
    Could you please advice me ? whats wrong with that script ?

    What is the error you get? What solutions have you tried already?

  • PHP forms submitted as an attachment rather than email?

    How do I get my PHP forms submitted as an attachment rather than email?
    Meaning, if I set up a form on my website and someone completes and submits it, how can I get the responses as an attachment rather than in email text?
    Much appreciated.
    G

    Hi Gunter
    I have spent so much time on this now.
    I have tried to convert the php to an attached .txt or .csv file.
    Learnt a lot but still can not seem to get the form data to be submitted as an attached file.
    Here are two of my attempts, please assist:
    <?php
    $email=$_REQUEST['email'];
    $firstName=$_REQUEST['firstName'];
    $lastName=$_REQUEST['lastName'];
    //The Attachment
    $cr = "\n";
    $data = "Email" . ',' . "First Name" . ',' . "Last Name" . $cr;
    $data .= "$email" . ',' . "$firstName" . ',' . "$lastName" . $cr;
    $fp = fopen('reservationTest.csv','a');
    fwrite($fp,$data);
    fclose($fp);
    // Mail to
    $email = "myemailaddress";
    //subject
    $subject = "Test Budget reservation";
    //Header
    $headers("Content-type: application/octet-stream");
    $headers("Content-Disposition: attachment; filename=reservationTest.csv");
    $headers("Pragma: no-cache");
    $headers("Expires: 0");
    //Message
    $message = "".
    "Email: $email" . "\n" .
    "First Name: $firstName" . "\n" .
    "Last Name: $lastName";
    mail($email, $subject, $message, $headers);
    ?>
    <html>
    <body>
    <table width="400" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <div align="center">Guperman Your Test Message Has Been Submitted</div>
    </td>
    </tr>
    </table>
    </body>
    </html>
    EOD;
    echo "$theResults";
    OR
    <?php
    /* subject and email variables */
    $email = $_POST['email'];
    $lastname = $_POST['lastname'];
    $firstname = $_POST['firstname'];
        $to = 'myemailaddress';
        $emailSubject = 'Test Form';
        $headers = "From: $email\n";
    $message = "A new reservation test.\n
    Last Name</b>: $lastname
    Name</b>: $firstname
    Email</b>: $email
        mail($to,$emailSubject,$headers,$message);
    //open the file and choose the mode
    $fh = fopen("reservationTest.txt", "a");
    fwrite($fh, $email);
    //close the file
    fclose($fh);
    ?>
    <html>
    <body>
    <table width="400" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <div align="center">Guperman Your Test Message Has Been Submitted</div>
    </td>
    </tr>
    </table>
    </body>
    </html>
    On both accounts when I test these files I get the following types of messages.
    Warning:  fopen(reservationTest.csv) [function.fopen]: failed to open stream: Permission denied in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 11
    Warning:  fwrite(): supplied argument is not a valid stream resource in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 12
    Warning:  fclose(): supplied argument is not a valid stream resource in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 13
    Fatal error:  Function name must be a string in \\HOSTING\DFS\20\1\9\1\2028751191\user\sites\mywebsite.com\www\reservationTest.php on line 22
    And then to give the .php files permission I left click on the already uploaded files and try and set the permission to 777, but then I get a response like: Setting Access Properties failed for:
    Your assistance is much appreciated. Regards

  • PHP form submission Problem

    Dear all,
    PHP enquiry form submission some error is comes
    "Parse error: syntax error, unexpected T_STRING in /home/newtocli/public_html/en45/send_form_email.php on line 11"
    Please help me
    WEBLINK
    PHP goes like this
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>PHP Form</title>
    </head>
    <body><?php
    if(isset($_POST['email'])) {
        // EDIT THE 2 LINES BELOW AS REQUIRED
        $email_to = "[email protected]";
        $email_subject = "Your email subject line";
        function died($error) {
            // your error code can go here
            echo "We are very sorry, but there were error(s) found with the form you submitted. ";
            echo "These errors appear below.<br /><br />";
            echo $error."<br /><br />";
            echo "Please go back and fix these errors.<br /><br />";
            die();
        // validation expected data exists
        if(!isset($_POST['first_name']) ||
            !isset($_POST['email']) ||
            !isset($_POST['telephone']) ||
                        !isset($_POST['company_name']) ||
            !isset($_POST['comments'])) {
            died('We are sorry, but there appears to be a problem with the form you submitted.');      
        $first_name = $_POST['first_name']; // required
        $email_from = $_POST['email']; // required
        $telephone = $_POST['telephone']; // not required
              $last_name = $_POST['company_name']; // required
        $comments = $_POST['comments']; // required
        $error_message = "";
        $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
      if(!preg_match($email_exp,$email_from)) {
        $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
        $string_exp = "/^[A-Za-z .'-]+$/";
      if(!preg_match($string_exp,$first_name)) {
        $error_message .= 'The First Name you entered does not appear to be valid.<br />';
      if(!preg_match($string_exp,$company_name)) {
        $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
      if(strlen($comments) < 2) {
        $error_message .= 'The Comments you entered do not appear to be valid.<br />';
      if(strlen($error_message) > 0) {
        died($error_message);
        $email_message = "Form details below.\n\n";
        function clean_string($string) {
          $bad = array("content-type","bcc:","to:","cc:","href");
          return str_replace($bad,"",$string);
        $email_message .= "First Name: ".clean_string($first_name)."\n";
        $email_message .= "Email: ".clean_string($email_from)."\n";
        $email_message .= "Telephone: ".clean_string($telephone)."\n";
              $email_message .= "Company Name: ".clean_string($company_name)."\n";
        $email_message .= "Comments: ".clean_string($comments)."\n";
    /* Redirect visitor to the thank you page */
    header('Location:gt.html');
    exit();
    // create email headers
    $headers = 'From: '.$email_from."\r\n".
    'Reply-To: '.$email_from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    @mail($email_to, $email_subject, $email_message, $headers); 
    ?>
    <!-- include your own success html here -->
    Thank you for contacting us. We will be in touch with you very soon.
    <?php
    ?>
    </body>
    </html>

    some error now
    Parse error: syntax error, unexpected T_STRING in /home/newtocli/public_html/send_form_email.php on line 5
    My form like this
    <form name="contactform" method="post" action="send_form_email.php">
                                                                                                                                                <div class="field text">
                                                            <input  type="text" name="first_name" maxlength="50" size="30" value="Name*:">
                                                            </div>
                                                                                                                                                <div class="field text">
                                                            <input  type="text" name="email" maxlength="80" size="30" value="E-mail*:">
                                                           </div>
                                                                          <div class="clear"><!-- --></div>
                                                                                                                                                <div class="field text">
                                                            <input  type="text" name="telephone" maxlength="30" size="30" value="Phone.:">
                                                            </div>
                                                                                                                                                <div class="field text">
                                                            <input  type="text" name="company_name" maxlength="50" size="30" value="Company:">
                                                            </div>
                                                                          <div class="clear"><!-- --></div>
                                                                          <div class="field textarea"><div>
                                                                            <textarea  name="comments"></textarea>
                                </div></div>
                                                                          <div class="submit">
                                                                                    <p>* - Required fields</p>
                                                                                    <input type="submit" value="Send" />
                                                                          </div>
                                                                </form>

  • PHP Fatal error

    I'm trying to work with CS3 and am designing a form to submit
    some data to the database and when I attempt to look at the page I
    get the following error:
    PHP Fatal error: Call to undefined function mysql_pconnect()
    What should I do? I don't have control over the server... so
    I really cant make configuration changes...
    all I get is a blank page the second I add a recordset...
    Help!!!
    -Warren

    AFAIK, establishing a persistent connection to a MySQL server
    (that´s what
    pconnect stands for) will only work on servers where PHP
    has been installed as Apache "module" --- seems that the remote
    server has it installed as CGI.
    Guess you´ll need to resort to using a regular
    non-persistent connection, means "mysql_connect()"
    works better ?

  • Configurable PHP form emailer

    I'm looking suggestions for a drop-in PHP form emailer
    script... something that I can either configure by using templates
    that are unique to each form or some other method of per-form
    configurability.
    I'm using soupermail.pl now, but would like to move away from
    it because it has issues with certain users who use AOL and have
    Norton security products (they will receive errors when submitting
    the form).
    I do not want to write a generic form mailer from scratch, as
    I am not comfortable with ensuring that it is safe from spammers...
    I would like to find something that I can use from several forms on
    my site. I do not need to write anything to a database, just be
    able to email to variable destination email accounts. I do not want
    to be able to upload or send attachments.
    Thanks for any suggestions.

    Hi there - read my article titled, "Validating your forms
    with PHP" - here:
    http://sourtea.com/articles.php
    At the end of the article, I provide the full, free code to
    do what you're
    looking for.
    HTH, take care.
    Shane H
    [email protected]
    http://www.avenuedesigners.com
    =============================================
    Web Dev Articles, Photography, and more:
    http://sourtea.com
    =============================================
    Proud GAWDS Member
    http://www.gawds.org/showmember.php?memberid=1495
    Delivering accessible websites to all ...
    =============================================
    "JillTW" <[email protected]> wrote in
    message
    news:eeebap$q71$[email protected]..
    > I'm looking suggestions for a drop-in PHP form emailer
    script... something
    > that
    > I can either configure by using templates that are
    unique to each form or
    > some
    > other method of per-form configurability.
    >
    > I'm using soupermail.pl now, but would like to move away
    from it because
    > it
    > has issues with certain users who use AOL and have
    Norton security
    > products
    > (they will receive errors when submitting the form).
    >
    > I do not want to write a generic form mailer from
    scratch, as I am not
    > comfortable with ensuring that it is safe from
    spammers... I would like to
    > find
    > something that I can use from several forms on my site.
    I do not need to
    > write
    > anything to a database, just be able to email to
    variable destination
    > email
    > accounts. I do not want to be able to upload or send
    attachments.
    >
    > Thanks for any suggestions.
    >

  • Error trying to open an Excel worksheet...getting Visual Basic MS Forms error

    Hi
    We have just upgraded a user from Office 2007 to 2013. However he is now unable to open an Excel spreadsheet and keeps getting Visual Basic errors
    MS Forms error. “Could not load an object because it is not available on this machine.”
    Acknowledge the error then..
    MS VBA error “Compile error Can’t find project or library”.
    On acknowledging and closing VB window the spreadsheet is available although VB is not running.
    VBA Project (Microsoft Forms 2.0 Object Library). However we still received the same errors.
    So we reinstalled Office 2013 to see if this would update the dll files. Alas the same error. Another user who works with VB said the FM20.dll files should be deleted and replaced with new ones. We acquired another FM20.dll file deleted the older one and
    replaced it in the folder. Rebooted but still the same error.
    He is using a 64bit Windows machine with Office 2013 click2run installed.
    We have spent 6 hours today trying to fix it with no luck.....Please can you help??
    Br
    Dan

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Excel, this issue is more related to the Office develop, please post your question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Need help with PHP form with checkboxes, radio buttons and file attachment

    Hi guys,
    I'm having a nightmare with this PHP form where a user can fill it in, attach a doc/pdf and submit. After trying to sort it out with previous code I've used, I've stripped it out and think I should just start again in the hope you geniuses can help!
    Here is the HTML of contact.php:
    <form action="" method="post" name="contact" id="contact">
        <p>Job Title:*<br />
        <input name="position" type="text" /></p>
        <p>Nationality:*<br />
        <select name="nationality">
          <option value="">-- select one --</option>
          <option value="Afghan">Afghan</option>
          <option value="Albanian">Albanian</option>
          <option value="Algerian">Algerian</option>
          <option value="Zambian">Zambian</option>
          <option value="Zimbabwean">Zimbabwean</option>
        </select>
        </p>
        <p>Which country are you currently living in?*<br />
        <select name="country">
        <option value="">-- select one --</option>
        <option value="United Kingdom">United Kingdom</option>
        <option value="Afghanistan">Afghanistan</option>
        <option value="Africa">Africa</option>
        <option value="Zambia">Zambia</option>
        <option value="Zimbabwe">Zimbabwe</option>
        </select>
        </p>
        <label class="radio" for="checkRight">Yes/No question?</label><br />
        <input class="radio" type="radio" name="right" value="Yes" /> Yes
        <input class="radio" type="radio" name="right" value="No" /> No
        <input class="radio" type="radio" name="right" value="N/A" /> Not applicable
        <p>Yes/No question?<br />
        <select name="continue">
        <option value="">-- select one --</option>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
        </select>
        </p>
        <p>Select your resorts:<br />
        Resort 1<input name="res1" type="checkbox" value="Resort 1" />
        Resort 2<input name="res2" type="checkbox" value="Resort 2" />
        Resort 3<input name="res3" type="checkbox" value="Resort 3" />
        Resort 4<input name="res4" type="checkbox" value="Resort 4" />
        Resort 5<input name="res5" type="checkbox" value="Resort 5" />
        Resort 6<input name="res6" type="checkbox" value="Resort 6" />   
        </p>
        <p>Don't send form unless this is checked:* <input type="checkbox" name="parttime" value="Yes" /></p>
        <p>Date of arrival: <input name="arrive" id="datepick" /><br />
        Date of departure: <input name="depart" id="datepick2" /></p>
        <script type="text/javascript" src="assets/scripts/datepickr/datepickr.js"></script>
        <link href="assets/scripts/datepickr/datepickr.css" rel="stylesheet">
        <script type="text/javascript">
        new datepickr('datepick');
        new datepickr('datepick2', {
        </script>
        <p>Name:*<br />
        <input name="name" type="text" /></p>
        <p>E-mail:*<br />
        <input name="email" type="text" /></p>
        <p>Telephone:*<br />
        <input name="telephone" type="text" class="ctextField" /></p>
        <p>Upload CV (Word of PDF formats only):<br />
        <input type="file" name="cv" class="textfield"></p>
        <p><input name="submit" value="Submit Enquiry" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
    </form>
    By the way, the date boxes work so excuse the Javascript in there!
    To prevent SPAM I've used a trick where there's a hidden URL field which must be left blank for the form to submit which you can see in the PHP.
    Below is where I'm at with the PHP which is placed above the header of contact.php...
    <?php
    if (array_key_exists('submit', $_POST)) {
        $position = $_POST['position'];
        $arrive = $_POST['arrive'];
        $nationality = $_POST['nationality'];
        $parttime = $_POST['parttime'];
        $depart = $_POST['depart'];
        $name = $_POST['name'];
        $email = $_POST['email'];
        $telephone = $_POST['telephone'];
    $to = "[email protected]";
    $subject = "Recruitment Application";
    $message = $headers;
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "E-mail: " . $_POST["email"] . "\r\n";
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= 'From: My Website <[email protected]>' . "\r\n";
    $message= "
    $url = stripslashes($_POST["url"]);
    if (!empty($url)) {
    header( 'Location: http://www.go-away-spam-robots.com' );
    exit();
    if (!isset($warning)) {
    mail($to, $subject, $message, $headers);
    header( 'Location: http://www.mywebsite.co.uk/sent.php' );
    ?>
    I would like to make pretty much all the field compulsory so if a field is left empty (other than the hidden URL field), a warning message is displayed next to that field.
    Also I would like the file upload field to attach to the email that is sent to me and have the results come through to me in a table format.
    Can anyone help me get my form working?
    Thank you and I hope to hear from you!
    SM

    Hi Nancy,
    Great stuff, thank you for the reply.
    I've managed to get the Formm@iler working and running as I need it to.
    The only thing I'm struggling with is when the user clicks submit, they are taken to a page of whatever results the form returned but it is just a white background with Times New Roman text.
    How can I have it so the user is taken to the form results in the websites' page layout?
    I tried sending them to a generic 'thank you' page by adding the following code but it just took them there whatever the results of the form so that's no good...! I have a feeling it's a bit more complicated than that...
    header( 'Location: http://www.nofussbus.co.uk/test/sent.php' );
    Thank you for your help!

  • There are some form errors after upgrading ebs from 12.1.1 to 12.1.3

    Hello , EBS experts,
    I have some upgrading issues need your great help. thanks in advance!
    We have installed EBS 12.1.1 on Oracle Linux 5.7, everything is okay.
    Now, we need to upgrading EBS from 12.1.1 to 12.1.3, after all the upgrading process were done. We have encountered the form error while opening the AR transaction forms as below
    ORA-01403: no data found
    FRM-40735: PRE-FORM trigger raised unhandled exception ORA-04062.
    Lots of Receivable forms have the same issue, I have upgrading the ebs from 12.1.1 to 12.1.3 with 2 times, but every time, I have encountered the same issue.
    Can anyone have me? it's very urgent for me to finish this task, thanks!
    Here is my upgrading process for your reference
    1. Installed the EBS 12.1.1 and everything is okay(Create a AR, AP transaction and invoice and post to gl).
    2. I have referenced this document to upgrading the EBS
    Oracle E-Business Suite Release 12.1.3 Readme [ID 1080973.1]
    To apply Oracle E-Business Suite Release 12.1.3, follow these steps:
    1) 9239089
    2) 9239090(US), then applied the 9239090_zhs as I have the zhs language on the EBS 12.1.1
    3) 9239095
    Post-Update Steps
    1. Apply post-install Oracle E-Business Suite Applications Technology patches. (Required)
    4)9817770
    5)9966055
    2. Update database tier nodes with the Oracle E-Business Suite Release 12.1.3 code level.
    Application tier:
    Database tier:
    3. I have applied the following patches before upgrading to 12.1.3(before step 2 as above)
    Database Preparation Guidelines for an E-Business Suite Release 12.1.1 Upgrade [ID 761570.1]
    Database Preparation Guidelines for an Oracle E-Business Suite Release 12.1.1 Upgrade
    Patch E
    B) For users on 11.1.0.7:
    7111245 - 7684818 also includes 7111245 but this is a later version of the patch. Disregard errors related to 7111245 being installed when applying 7684818.
    7211965
    7330434
    7486407
    7627743
    7639602
    7684818
    8199107
    8639653
    8940108
    9026927
    9066130
    9554727
    9743057
    (I have compared the above patches with my db(ebs 12.1.1 ) and some patches have already been applied based on EBS 12.1.1), and the following patches were not included on the db, so I applied the following patches one by one
    7684818
    8199107
    8639653
    8940108
    9026927
    9066130
    9554727
    9743057
    Modify Initialization Parameters
    disablefast_validate=TRUE
    pgamax_size=104857600
    Can anyone help me on this issue? thanks!
    Open AR forms such as transaction, receipt, etc, and always encountered the same issues as below
    ORA-01403: no data found
    FRM-40735: PRE-FORM trigger raised unhandled exception ORA-04062.
    The AR forms opened failed. thanks!
    Thanks!
    Chuan Ling

    Hi, Helios,
    Thanks for your great help on this issues.
    Here is my verification result for your reference as below
    1.Known errors generated on the People form (PERWSHRG) [ID 206584.1]
    10 -      Error: FRM-40735:PRE-FORM trigger raised unhandled exception ORA-04062.
    ORA-01403:no data found
    APP-FND-01242:cannot read value from field: GLOBAL.G_NAV_NODE_USAGE_ID
    Cause: The field: Global.G_NAV_NODE_USAGE_ID couldn't be located or read.
         Resolution: This is an issue associated with multiple APPL_TOPS. Ensure
    that references to the APPL_TOP are pointing to correct one.
    I don't know how to fix this? do you know?
    2.After Upgrade From R12.0.4 To 12.1.1 Property Manager Forms Give Error FRM-40735 [ID 1092394.1]
    [r12app@infsgvm14 forms]$ strings -a $PN_TOP/patch/115/sql/PNPFUNCB.pls | grep '$Header:'
    -- $Header: PNPFUNCB.pls 120.19.12010000.12 2010/03/26 10:43:10 rthumma ship $
    my file's version is 120.19.12010000.12, so ignore this step
    3.Property Manager Forms Error FRM-40735 After Upgrade From 12.0.6 to 12.1.2 [ID 1091124.1]
    did you know how to set this 1) Please set Property Manager status to "Installed" via License Manager.
    I don't find this on license manager.
    4.Frm-40735 Ora-04062 When Trying To Open Transactions Form [ID 1363671.1]
    just checked the custom.pll and custom.plx and they are existed in AU_TOP/resource, I want to re-generated this custom.plx using this
    frmcmp module=CUSTOM.pll userid=apps/apps@hostname module_type=LIBRARY
    but have some issues.
    [r12app@infsgvm14 resource]$ frmcmp module=CUSTOM.pll userid=apps/[email protected] module_type=LIBRARY
    Forms 10.1 (Form Compiler) Version 10.1.2.3.0 (Production)
    Forms 10.1 (Form Compiler): Release - Production
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    PL/SQL Version 10.1.0.5.0 (Production)
    Oracle Procedure Builder V10.1.2.3.0 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.0 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE 10.1.0.5.0 Production
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    so, it's strange.
    Thanks!
    Chuan Ling

Maybe you are looking for