Jump to content

Noob PHP attempt. Need to add fields to existing working code.


leasure23

Recommended Posts

I have a website I have been working on for my company. I am trying to make this a low cost of a venture as posssible. I need to make a request quote form that uses PHP but I don't want to pay for a template. I made a simple one that I figured out from a video on you tube. Had to learn somewhere. Anyways I got the simple form to work when I posted a test. The form only contains these 3 fields

 

Name

email

inquiry text box

submit Quote button.

 

I would like to add a couple more fields but when I try I get errors. It's obvious to me that I can't just figure it out without the help of experinced people. So I asking for some help. I would like to have the form include these fields in order.

 

Name

Company

Phone

Email

Comments

Upload Drawing(I work with autocad and solidworks drawings so I need the ability to attach drawings)

Submit Quote button

 

That is all for the form fields. I have a easy setup for my code as is. I have the main form page as step1.html. The .php code is labeled as step2.php which contains variables for step1.html and the last is step3.html which is triggered when a quote is submitted. It comes up and says thanks for the submission. I will try to add all three pieces and if any one can help that would be great. My bosses have been on me to get this done. Without $$$ and limited knowledge it has been difficult.

 

Thanks, Matt

 

Here is step1.html

 

<body>
   <form action="step2.php" method="post">
      Name<br/><input type="text" name="username" /><br/>
      Email<br/><input type="text" name="email"/><br/>
      Inquiry<br><textarea row="7" cols="70" name="inquiry"></textarea><br/>
      <input type="Submit" value="Send your Inquiry" />
   </form>

 

okay here is step2.php

 

<?php

$name = $_POST['username'];
$email = $_POST['email'];
$text = $_POST['inquiry'];

//To, Subject, Message, Header
mail('[email protected]', 'Basic Inquiry', $text, 'From: ' . $name . ' <' . $email . '>');

header('Location: step3.html');

?>

 

And last step3.html

 

<body>
Thank you for your inquiry.
</body>

 

I left off my real email address. The main goal is to gather this information from the request quote to our sales email address. Any help or suggestions will greatly be appreciated. Thanks again!!

This can actually be a one-pager.. once you get the basics down.

 

HTML Forms with PHP:

http://www.tizag.com/phpT/examples/formex.php

 

Upload a file:

http://www.tizag.com/phpT/fileupload.php

[OR]

E-mail attachment:

http://www.tizag.com/phpT/fileupload.php

 

 

You need to consider the size of the CAD drawings as if they are too big they might be rejected or time out while sending.  Look in to at least the first link to get your form setup, then worry about the email attachment (or upload to a server).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.