PDA

View Full Version : ??? Can't Get the Form To Work......PLS Help


gpiex
03-23-2004, 07:42 PM
Hello,

I am the website developer for E-Imports and am trying to get a form to work and I need some help.

The form is located at:

http://www.e-importz.com/Inquiry_Form/Inquiry_Form.htm

Here is a part of the code:...........

---------------------------------------------------------------------------------

<FORM name=contactform action=/cgi-sys/FormMail.cgi
method=post>
<TABLE cellSpacing=2 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD colSpan=3>
<DIV class=contenttitle><SPAN class=body>Want
More Information?</SPAN>
<INPUT type=hidden
value=contact.txt name=_send_email1>
<input
type=hidden value=reply.txt
name=_send_email2>
<INPUT type=hidden
value=response.php name=_browser_out>
<INPUT
type=hidden value=error.php
name=_error_path>

--------------------------------------------------------------------------


When you fill in the form (required parts) and click on submit. I get this error:

----------------------------------------------------------------------

There are missing fields!
recipient is missing

Form Dump:
_browser_out: response.php
_error_path: error.php
_send_email1: contact.txt
_send_email2: reply.txt
comment:
company:
fax:
industry: Please Select
other:
r_firstname:
r_lastname:
r_phone:
re_email:
submitbuttonname: Submit
url:
----------------------------------------------------------------------


Any assistance will be usefull.

Thank you

E-Imports Website Administrator and Developer


PS: I have also attached the form.

gpiex
03-24-2004, 01:57 PM
Hello,

I finally figured out what was wrong, however, i still need some help with organizing the e-mail they send me.


If you fill in the form at http://www.e-importz.com/Inquiry_Form/Inquiry_Form.htm, this is what the email looks like when I receive it:

--------------------------------------------------------------------------------

additional_information: Test

also_interested_in1: Carts

also_interested_in2: Kiosks

company: Self Employed

estimated_budget: Over $5,000

estimated_purchase_time: Please Select

fax: No Fax

first_name: Sam

inquiry1: European Crafted Espresso Stand

inquiry2: Norway Spruce Cabin Kit

inquiry3: European Crafted Recreational Cabin

inquiry4: Espresso Turnkey Business Package

inquiry5: Espresso Equipment

inquiry6: On-line Articles

last_name: H

main_purpose1: &lt;SPAN class=body&gt;Business Use&lt;/SPAN&gt;

order_qty: 5 + Units

phone: 000-000-0000

submit: Submit Inquiry
--------------------------------------------------------------------------------



If anyone knows how to organize it, please let me know.

Thank you

TomD
03-24-2004, 02:39 PM
How would you like it organized?

You can check the FormMail Site (http://www.scriptarchive.com/formmail.html) for more information but I think FormMail just parses the list of form fields and emails them to you (thus the name).

If you would like the email message formatted in a particular way and/or the form field info posted to a database that can all be done with PHP but not FormMail.

gpiex
03-24-2004, 03:30 PM
TomD,

I really appreciate the reply.

How would I be able to organize the e-mail I receive through PHP?


Thank you

TomD
03-24-2004, 04:08 PM
I am not clear on what you want.

You can use PHP for format the fields in any way you want as the information is passed to the PHP scripts as variables (a global array actually) that you can then use to save the info to a MySQL database, write a text or HTML email, display on a WEB page, send as XML or you name it.

PHP is the server side scripting language available on HostRocket servers. More info is available at www.php.net , www.phpfreaks.com , www.phpbuilder.com and many other sites. Google PHP and you will start to get an idea.

Cope
03-24-2004, 04:12 PM
There are tons of different ways to use php for a form-mail script. Its really simple to setup and use. Depends on what your definition of "organized" is though. Because to me...the way you posted out is what I like. If you want it to send email in HTML format they can get more complex. with images ect. But for a basic form, I dont know how much better you could go than that.

something like

(note some of the below isnt all cleaned out...some of it... *might* not be needed, lol. Took this from a form I have that is quite a bit bigger...best I can do for now :p


<?php

$recipientname = "name of page/organization/ect";
$recipientemail = "you@domain.com";
$subject = "Form Mail from $recipientname";
$thanks = "Thank you.";


?>

head and all that go right about here
along with the start of your page, like nav ect ect.... <body> most surely.

<?php
if($submitform) {

$name = $HTTP_POST_VARS['name'];
$email = $HTTP_POST_VARS['email'];
$comments = $HTTP_POST_VARS['comments'];

$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<br>";
}
}

if($error) {
?>

<b>Error</b><br>
<?php echo $error; ?><br>
<a href="#" onClick="history.go(-1)">try again</a>
<?php
}
else
{

$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR;
$toemail = "whotosenditto@domain.com";

$message = "Form from $recipientname:

Name: $Name
username: $username

Comments: $comments

User IP: $ip";

$hurrah = mail($toemail,"$subject","$message","From: $Name

<$Email>");
if($hurrah) {

echo "$thanks";
}
}
}
else {
?>
<form name="contactform" action="/page.php" method="post">
<input type="hidden" name="toemail" value="to@domain.com">
<input type="hidden" name="toname" value="Form info blah">
<input type="hidden" name="require" value="Name,username,comments">
<div align="left" id="txt">Name:</div>
<div align="left"><input name="Name" size="25"></div><br />
<div align="left" id="txt">Username:</div>
<div align="left"><input name="username" size="25"></div><br />
<div align="left" id="txt">Comments</div>
<div align="left"><textarea name="comments" rows="5"cols="35"></text></div><br />
<input type="submit" value="Submit" name="submitform">
<input type="reset" value="Reset" name="reset">

<br />
<?php } ?>
</form>
</body>
</html>

gpiex
03-25-2004, 05:22 PM
Hi,

Once again, thank you for the reply.

What I am basically trying to do is to program the script in such a way so that I receive emails like this:

---------------------------------------------------------------------------

To: admin@e-importz.com
From: [email]
Subject: Inquiry from [firstname] [lastname].

The Following Information Has Been Submitted:

Contact Information:

[firstname] [lastname]
Email [email]
PH [r_phone]
FX [fax]
Company - [company]
WebSite - [url]
______________________________________
This Inquiry is for:
[request1]
[request2]
[request3]
[request4]
[request5]
[request6]
[request7] [other]
______________________________________
Used For:
[purpose1]
[purpose2]
______________________________________
Estimated Purchase Time:[Industry]
______________________________________
Function Required:
[function1]
[function2]
[function3]
[function4]
[function5]
[function6]
[function7]
[function8]
______________________________________
Expected Order Quantity:
[package]
______________________________________
Estimated Budget:
[budget]
______________________________________
Comment:
[comment]
______________________________________

Automated Mail Attendent


--------------------------------------------------------------------------------



Rather than receiveing email like this:



additional_information: Test

also_interested_in1: Carts

also_interested_in2: Kiosks

company: Self Employed

estimated_budget: Over $5,000

estimated_purchase_time: Please Select

fax: No Fax

first_name: Sam
-----------------------------------------------------------------------------------


I would like to figure out a way where it can take the inputs from the customer, redirect it into a file where it organizes it and then sends it all organized.


I know this is possible, i just dont know how to program it.


Please let me know if anyone can help

Thank you

Cope
03-25-2004, 10:26 PM
If you look at what I posted.....

$message = "Form from $recipientname:

Name: $Name
username: $username

Comments: $comments

User IP: $ip";


Does just what you are asking. You can format that however you would like it. Putting -------------- across it or whatever. For the form part down at the bottom put the fields that you want 'required' into the 'required' tag with their name. Using $fieldname to put the value into the email.

gpiex
03-26-2004, 01:44 AM
Thank you for the reply, once again.


I will look into it and see what I can do.

Can I embedd the PhP code within my existing list?

I will let you know if I have any other questions.


Thank you

Cope
03-26-2004, 02:02 AM
Yeah you can. Its kind of a generic little form.
Nothing really complex about it.
I'd get it written out for you, but Im still at work. Not very hard to do either.

DarkWarriorXII
03-28-2004, 02:46 PM
I used your code as a base and it worked fine, but how do you get certain fields not to appear in the e-mail? Like the e-mail I receive is as follows (just as a test):


toname: Form info blah

require: Name,username,comments

username: DarkWarriorXII

comments: tets test test tset

redirect: http://www.kowlclan.com

submitform: Submit

name: name:P


As you can see, even the submit button appears on the results. How can I stop this from happening? I didn't edit any of your code except the e-mail address, etc.

Cope
03-28-2004, 09:12 PM
Unless you add $submit and $reset to the below code....it shouldnt.

$message = "Form from $recipientname:

Name: $Name
username: $username

Comments: $comments

User IP: $ip";

Here (http://xt10.net/cope/formhelp/form.phps) is the example I put up that works. Below is the email I recieve.

<>

Form from name of pageorganizationect:

Name: Patrick
username: iandasdjkn

Comments: jbdabsdbasd

User IP: x.x.x.x

Cope
03-29-2004, 02:11 AM
If you really want. Send me an Email with the form you want and I can fit it all around the code when I get time. Doesnt take long at all for me to do that.

gpiex
03-29-2004, 03:03 PM
Does Anyone Have the Time to help me REDO the form at http://www.e-importz.com/Contact/Inquiry_Form.htm and to make it so that I can receive e-mails like this:


To: admin@e-importz.com
From: [email]
Subject: Inquiry from [firstname] [lastname].

The Following Information Has Been Submitted:

Contact Information:

[firstname] [lastname]
Email [email]
PH [r_phone]
FX [fax]
Company - [company]
WebSite - [url]
______________________________________
This Inquiry is for:
[request1]
[request2]
[request3]
[request4]
[request5]
[request6]
[request7] [other]
______________________________________
Used For:
[purpose1]
[purpose2]
______________________________________
Estimated Purchase Time:[Industry]
______________________________________
Function Required:
[function1]
[function2]
[function3]
[function4]
[function5]
[function6]
[function7]
[function8]
______________________________________
Expected Order Quantity:
[package]
______________________________________
Estimated Budget:
[budget]
______________________________________
Comment:
[comment]
______________________________________

Automated Mail Attendent


--------------------------------------------------------------------------------



Rather than receiveing email like this:



additional_information: Test

also_interested_in1: Carts

also_interested_in2: Kiosks

company: Self Employed

estimated_budget: Over $5,000

estimated_purchase_time: Please Select

fax: No Fax

first_name: Sam

--------------------------------------------------------------------------------


I guess I'm Still not understanding how PHP works.

Cope
03-29-2004, 06:17 PM
I can, send me all the info. Like who the email needs to be sent to. Along with all the info in the form.

gpiex
03-29-2004, 06:31 PM
Hi,

Thank you for the reply.

I really appreciate you taking the time to assist me with this Inquiry Form.

You will find 2 documents in the zipped file.

One is the inquiry form, and the other is a document which describes how I would like to receive e-mails.


Thank you

Cope
03-29-2004, 10:11 PM
Ill work on it once I get to work and have some free time, but itll be done tonight