Trying to merge addform and mailform

9 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: April 5, 2012   (RSS)

Re: [thenetgirl] Trying to merge addform and mailform

By Jason - April 2, 2012

Hi,

You would use:

if (@$_REQUEST['submit'])

because in your form you have this hidden field:

<input type="hidden" name="submit" value="1" />

so the if statement is just looking to see if there is a value in that variable. If there is, it means the form had been submitted.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Trying to merge addform and mailform

By thenetgirl - April 2, 2012

Thanks so in the addform where would I put this ?



// send email user
if (!$errorsAndAlerts) {
$from = $_REQUEST['email'];
$to = "patricia@thenetgirl.com";
$subject = "Email form submitted from {$_SERVER['HTTP_HOST']}";
$message = <<<__TEXT__
You've received an email from the email form here:
[url "http://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME'"]http://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME'[/url]]}

Full name: {$_REQUEST['fullname']}
Email: {$_REQUEST['email']}
Message: {$_REQUEST['message']}

The user who sent this message had the IP address {$_SERVER['REMOTE_ADDR']}.
__TEXT__;

// send message
$mailResult = @mail($to, $subject, $message, "From: $from");
if (!$mailResult) { die("Mail Error: $php_errormsg"); }

//
$errorsAndAlerts = "Thanks! We've sent your email.";
$_REQUEST = array(); // clear form values
}

}
Patricia

www.thenetgirl.com

Re: [thenetgirl] Trying to merge addform and mailform

By (Deleted User) - April 3, 2012

Hi thenetgirl,

That would probably best sit after the
$recordNum = mysql_insert_id();

You wouldn't need to wrap it in the "if (!$errorsAndAlerts) { " as that's already been checked before the insert is done.

Let me know if this helps,

Tom

Re: [Tom P] Trying to merge addform and mailform

By thenetgirl - April 3, 2012

No Matter where I put it I get a blank page
Patricia

www.thenetgirl.com

Re: [thenetgirl] Trying to merge addform and mailform

By (Deleted User) - April 4, 2012

Hi,

Do you get a blank page after submitting the form or just when trying to load the page?

If you could attach the code for the entire page I could have a quick look over and see if there is anything stopping the page from displaying in either case.

Thanks,

Tom

Re: [Tom P] Trying to merge addform and mailform

By thenetgirl - April 4, 2012

I got it to post amd mail finally but the email is coming from my apache server and I dont know how to fix that
Patricia

www.thenetgirl.com
Attachments:

medical_addform.php 7K

Re: [thenetgirl] Trying to merge addform and mailform

By (Deleted User) - April 4, 2012

Hi thenetgirl,

The settings for where your mail comes from (i.e. what server sends the mail, as opposed to from which address) can be managed in an .htaccess file
# send mail from the below server
php_value SMTP send.mail.server.net

or directly through php.ini
//...rest of php.ini
[mail function]
SMTP = smtp.mailfromthisdomain.net
//...rest of php.ini


Let me know if this helps,

Tom

Re: [Tom P] Trying to merge addform and mailform

By thenetgirl - April 5, 2012

well thanks for the advice but think I let it be ..I host there site but not heir email.
Patricia

www.thenetgirl.com