Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Trying to create a php form....need some help


seCret steVe

Recommended Posts

I been working on a php form with no aval. The bases of the form i have now just converted over to HTML and hoping that someone might be able to help me swap it back to php. Mainly im what im trying to do is create it so that it will email the results to questions on the page. Here is what it looks like:

 

www.nstial.com/steven/alt/question.php

 

im trying to get it done by the end of the week before church starts so if someone could give me assistance that would great (im not the best of all coders)

 

Thanks for your help in advanced....

 

also to let you all know this is the first form i have ever created which is why it giving me a bitchin time

 

Steve

Link to comment
Share on other sites

In general any form name in php will be available as a $var on the page you call with the form:

 

<form method="post" action="proces_mail.php">

  <input type="text" name="customer_name">

  <select name="music_type">

   <option name="jazz">Jazz

   <option name="rock">Rock

   <option name="blues">Blues

   <option name="metal">Metal

  </select>

</form>

 

 

Now in process_mail.php you would have $name and $music_type as a variable. Next you format your message:

 

$msg = 'Music Type: ' . $music_type . "n";

$msg .= 'Name: ' . $name . "n"; //note the .= not just =

$msg .= 'whatever... '

 

and mail it with the tep_mail() function.

 

HTH

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

$name

 

oops... that should be $customer_name in all occurances.

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

here is a snip from the main file which is question one:

 

 

 <table width="75%" border="0">

   <form method="post" action="http://www.nstial.com/steven/alt/process_mail.php">

           <tr> 

             <td class="text"><center>

                 <span class="fontsmall"> 1</span> - Type of Service: If you 

                 were considering attending an alternate worship service, what 

                 type of service would you consider? (check all that apply) </center></td>

           </tr>

         </table>

         <table width="75%" border="0" class="subwrapper">

           <tr> 

             <td> <input type="checkbox" name="Question1" value="Contemprary">

               Contemporary </td>

           </tr>

           <tr> 

             <td> <input type="checkbox" name="Question1" value="Jazz">

               Jazz </td>

           </tr>

           <tr> 

             <td> <input type="checkbox" name="Question1" value="Gospel">

               Gospel </td>

           </tr>

           <tr> 

             <td> <input type="checkbox" name="Question1" value=" Casual dress">

               Casual dress/casual format </td>

           </tr>

           <tr> 

             <td height="17"> <input type="checkbox" name="Question1" value="Other">

               Other (If so, what kind? i.e. drama, rock, art, tech/multi-media, 

               etc.) </td>

           </tr>

           <tr> 

             <TD vAlign=top align=center width=75% height="3"><font face="Verdana" size="1"> 

               <input onmouseover='this.focus()' size=60 name="Question1" class=surround>

               </font></td>

           </tr>

         </table>

 

 

and this is a snip from the process_mail.php

 

<?

//Process Question 1

$msg = 'Music Type: ' . $Question1 . "n"; 

$msg .= 'Name: ' . $Question1 . "n"; //note the .= not just = 

$msg .= 'answer is ';



mail('[email protected]','From ME','$msg','');

?>

 

And nothing is receiving in my mail...i get an empty email is all i get.

 

Steve

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...