473,672 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What To Do After Making A Submit Button

3 New Member
Hi all, this is my first time ever using PHP, and I am still very new to programming in general. I'm doing an assignment for my Media E-Commerce class where the code for a survey is all provided. It first asks the user to provide their first and last name in two text boxes, and then has three separate tables where the user can choose a rating from 1 to 5 in radio buttons. Then, once they are done, they click the submit button. From there, a new table is supposed to come up I'm assuming on a new page that is separated into two columns (rating and count) with the answers that the user submitted in the survey, which is basically my assignment to complete.

I've been reading many tutorials and forums all day trying to figure this out, but since I have very limited programming knowledge in general, I'm having quite a hard time with this even though I've seen similar posts where responses say this type of thing is not difficult at all to complete. However, I still cannot figure it out. Any help given will be much appreciated. Thanks a lot.

This is the code of the survey
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Untitled Document</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. </head>
  7.  
  8. <body bgcolor="#0000CC" text="#CCCCCC">
  9. <div align="center"><strong><font size="6" face="MS Sans Serif">The University 
  10.   of Bithlo </font></strong><font size="6" face="MS Sans Serif"></h1> </font></div>
  11. <form action="test.php" method="post" name="bithlosurvey" id="bithlosurvey">
  12. </form>
  13. <form name="form1" method="post" action="">
  14.   <p align="center"> <font face="MS Sans Serif">
  15.     <input name="firstname" id="firstname" type="text">
  16.     Student's First Name</font></p>
  17.   <p align="center"> <font face="MS Sans Serif">
  18.     <input name="lastname" id="lastname" type="text">
  19.     Student's Last Name </font></p>
  20. </form>
  21. <p align="left"><font face="MS Sans Serif">Please use a scale of 1 (first-rate; 
  22.   great; awesome) through 5 (really really really really really terrible) to answer 
  23.   each of these questions. </font></p>
  24. <p align="center"><font face="MS Sans Serif"><strong>Course 1: Removing Ash Trays 
  25.   from 1991 Ford Tauruses</strong></font></p>
  26. <p align="center"><font face="MS Sans Serif"><strong>Instructor: Roy Rogers</strong></font></p>
  27. <div align="center"> 
  28.   <table border="4" cellpadding="4" cellspacing="0">
  29.     <tbody>
  30.       <tr> 
  31.         <th scope="col">&nbsp;</th>
  32.         <th scope="col"><font face="MS Sans Serif">Great</font></th>
  33.         <th scope="col"><font face="MS Sans Serif">Good</font></th>
  34.         <th scope="col"><font face="MS Sans Serif">OK</font></th>
  35.         <th scope="col"><font face="MS Sans Serif">So-So</font></th>
  36.         <th scope="col"><font face="MS Sans Serif">Sucks Lemons </font></th>
  37.       </tr>
  38.       <tr> 
  39.         <td><font face="MS Sans Serif">Quality of Lectures </font></td>
  40.         <td> <font face="MS Sans Serif">
  41.           <input name="reply1.1" value="1" type="radio">
  42.           1</font></td>
  43.         <td> <font face="MS Sans Serif">
  44.           <input name="reply1.1" value="2" type="radio">
  45.           2 </font></td>
  46.         <td> <font face="MS Sans Serif">
  47.           <input name="reply1.1" value="3" type="radio">
  48.           3</font></td>
  49.         <td> <font face="MS Sans Serif">
  50.           <input name="reply1.1" value="4" type="radio">
  51.           4</font></td>
  52.         <td> <font face="MS Sans Serif">
  53.           <input name="reply1.1" value="5" type="radio">
  54.           5</font></td>
  55.       </tr>
  56.       <tr> 
  57.         <td><p><font face="MS Sans Serif">Quality of Handouts</font></p></td>
  58.         <td> <font face="MS Sans Serif">
  59.           <input name="reply1.2" value="1" type="radio">
  60.           1</font></td>
  61.         <td> <font face="MS Sans Serif">
  62.           <input name="reply1.2" value="2" type="radio">
  63.           2 </font></td>
  64.         <td> <font face="MS Sans Serif">
  65.           <input name="reply1.2" value="3" type="radio">
  66.           3</font></td>
  67.         <td> <font face="MS Sans Serif">
  68.           <input name="reply1.2" value="4" type="radio">
  69.           4</font></td>
  70.         <td> <font face="MS Sans Serif">
  71.           <input name="reply1.2" value="5" type="radio">
  72.           5</font></td>
  73.       </tr>
  74.     </tbody>
  75.   </table>
  76. </div>
  77. <p align="center">&nbsp;</p>
  78. <p align="center"><font face="MS Sans Serif"><strong>Course 2: Removing Rear Bumpers 
  79.   from 1987 Chevy S-10s </strong></font></p>
  80. <p align="center"><font face="MS Sans Serif"><strong>Instructor: Gene Autry </strong></font></p>
  81. <div align="center"> 
  82.   <table border="4" cellpadding="4" cellspacing="0">
  83.     <tbody>
  84.       <tr> 
  85.         <th scope="col">&nbsp;</th>
  86.         <th scope="col"><font face="MS Sans Serif">Great</font></th>
  87.         <th scope="col"><font face="MS Sans Serif">Good</font></th>
  88.         <th scope="col"><font face="MS Sans Serif">OK</font></th>
  89.         <th scope="col"><font face="MS Sans Serif">So-So</font></th>
  90.         <th scope="col"><font face="MS Sans Serif">Sucks Lemons </font></th>
  91.       </tr>
  92.       <tr> 
  93.         <td><font face="MS Sans Serif">Quality of Lectures </font></td>
  94.         <td> <font face="MS Sans Serif">
  95.           <input name="reply2.1" value="1" type="radio">
  96.           1</font></td>
  97.         <td> <font face="MS Sans Serif">
  98.           <input name="reply2.1" value="2" type="radio">
  99.           2 </font></td>
  100.         <td> <font face="MS Sans Serif">
  101.           <input name="reply2.1" value="3" type="radio">
  102.           3</font></td>
  103.         <td> <font face="MS Sans Serif">
  104.           <input name="reply2.1" value="4" type="radio">
  105.           4</font></td>
  106.         <td> <font face="MS Sans Serif">
  107.           <input name="reply2.1" value="5" type="radio">
  108.           5</font></td>
  109.       </tr>
  110.       <tr> 
  111.         <td><p><font face="MS Sans Serif">Quality of Handouts</font></p></td>
  112.         <td> <font face="MS Sans Serif">
  113.           <input name="reply2.2" value="1" type="radio">
  114.           1</font></td>
  115.         <td> <font face="MS Sans Serif">
  116.           <input name="reply2.2" value="2" type="radio">
  117.           2 </font></td>
  118.         <td> <font face="MS Sans Serif">
  119.           <input name="reply2.2" value="3" type="radio">
  120.           3</font></td>
  121.         <td> <font face="MS Sans Serif">
  122.           <input name="reply2.2" value="4" type="radio">
  123.           4</font></td>
  124.         <td> <font face="MS Sans Serif">
  125.           <input name="reply2.2" value="5" type="radio">
  126.           5</font></td>
  127.       </tr>
  128.     </tbody>
  129.   </table>
  130. </div>
  131. <p align="center">&nbsp;</p>
  132. <p align="center"><font face="MS Sans Serif"><strong>Course 3: Stealing Customer's 
  133.   Far-Side Hubcaps to Sell to Him </strong></font></p>
  134. <p align="center"><font face="MS Sans Serif"><strong>Instructor: Lash Larue </strong></font></p>
  135. <div align="center"> 
  136.   <table border="4" cellpadding="4" cellspacing="0">
  137.     <tbody>
  138.       <tr> 
  139.         <th scope="col">&nbsp;</th>
  140.         <th scope="col"><font face="MS Sans Serif">Great</font></th>
  141.         <th scope="col"><font face="MS Sans Serif">Good</font></th>
  142.         <th scope="col"><font face="MS Sans Serif">OK</font></th>
  143.         <th scope="col"><font face="MS Sans Serif">So-So</font></th>
  144.         <th scope="col"><font face="MS Sans Serif">Sucks Lemons </font></th>
  145.       </tr>
  146.       <tr> 
  147.         <td><font face="MS Sans Serif">Quality of Lectures </font></td>
  148.         <td> <font face="MS Sans Serif">
  149.           <input name="reply3.1" value="1" type="radio">
  150.           1</font></td>
  151.         <td> <font face="MS Sans Serif">
  152.           <input name="reply3.1" value="2" type="radio">
  153.           2 </font></td>
  154.         <td> <font face="MS Sans Serif">
  155.           <input name="reply3.1" value="3" type="radio">
  156.           3</font></td>
  157.         <td> <font face="MS Sans Serif">
  158.           <input name="reply3.1" value="4" type="radio">
  159.           4</font></td>
  160.         <td> <font face="MS Sans Serif">
  161.           <input name="reply3.1" value="5" type="radio">
  162.           5</font></td>
  163.       </tr>
  164.       <tr> 
  165.         <td><p><font face="MS Sans Serif">Quality of Handouts</font></p></td>
  166.         <td> <font face="MS Sans Serif">
  167.           <input name="reply3.2" value="1" type="radio">
  168.           1</font></td>
  169.         <td> <font face="MS Sans Serif">
  170.           <input name="reply3.2" value="2" type="radio">
  171.           2 </font></td>
  172.         <td> <font face="MS Sans Serif">
  173.           <input name="reply3.2" value="3" type="radio">
  174.           3</font></td>
  175.         <td> <font face="MS Sans Serif">
  176.           <input name="reply3.2" value="4" type="radio">
  177.           4</font></td>
  178.         <td> <font face="MS Sans Serif">
  179.           <input name="reply3.2" value="5" type="radio">
  180.           5</font></td>
  181.       </tr>
  182.     </tbody>
  183.   </table>
  184. </div>
  185. <form name="form2" method="post" action="">
  186.   <div align="center"> <font face="MS Sans Serif">
  187.     <input name="Submit" value="Submit" type="submit">
  188.     </font></div>
  189. </form>
Feb 10 '07 #1
4 1490
ronverdonk
4,258 Recognized Expert Specialist
Before you post any further in this forum, read the Posting Guidelines, especially the part about enclosing your code within code or php tags!!!

Moderator
Feb 10 '07 #2
Atli
5,058 Recognized Expert Expert
Hi.

This is a code that uses html forms and php to send an email.
I thought it might help you do your assignment.

Note. Both html and php should be in the same .php file
[HTML]<!--
The Form, if you have your php code in another file
you should put the url in the action field
of the form element.
I leave it emtpy because I want it to post to
the same file it is in.
-->
<form name="MyForm" method="post" action="">
<table width="400" border="0" align="center" cellpadding="2" cellspacing="0" >
<tr>
<td width="50%" align="right">F rom : </td>
<td><input name="From" type="text" size="30" /></td>
</tr>
<tr>
<td align="right">T o : </td>
<td><input name="To" type="text" size="30" /></td>
</tr>
<tr>
<td align="right">S ubject : </td>
<td><input name="Subject" type="text" size="30" /></td>
</tr>
<tr>
<td align="right">M essage : </td>
<td><textarea name="Message" cols="30" rows="7"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center">
<!--
The submit button, this is the value I use to
check if the form has been submitted in the php code
-->
<input name="MySubmit" type="submit" value="Send" />
</td>
</tr>
</table>
</form>
[/HTML]
[PHP]
<?php
// Find if the form has been posted
// by checking if the button 'MySubmit'
// has a value.
if(isset($_POST['MySubmit']))
{
// Get the other information
// using the $_POST array
// to read the information you
// posted in your form
$From = $_POST['From'];
$To = $_POST['To'];
$Subject = $_POST['Subject'];
$Msg = $_POST['Message'];

// Set up Email headers
$headers = 'From: '. $From;

// Send email and check if it was sent
if(mail($To, $Subject, $Msg, $headers))
{
echo "<p align='center'> Your email has been sent </p>";
}
else
{
echo "<p align='center'> An error accured while sending your email </p>";
}
}
?>[/PHP]
Feb 10 '07 #3
FlaPnthrsPunk
3 New Member
Before you post any further in this forum, read the Posting Guidelines, especially the part about enclosing your code within code or php tags!!!

Moderator
Sorry about that. I will read the guidelines now. I wasn't even aware you could do that with the code, but thanks for editing for me anyway.
Feb 10 '07 #4
FlaPnthrsPunk
3 New Member
Hi.

This is a code that uses html forms and php to send an email.
I thought it might help you do your assignment.
Thank you very much. I have a feeling this example will help me a lot, not just on this assignment, but in PHP overall in general.
Feb 10 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
46011
by: Matt | last post by:
I always see the term "postback" from ASP book, but I am not sure if I fully understand the meaning. Here's my understanding so far, please correct me if any mistakes. Here's a typical html form: <form action="process.asp" method="post"> 'GUI code </form> "postback" action happens when the user click the submit button, that means
2
41045
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not sure how to do it in javascript <form name="form1" method="post" action="myNewplace.asp" ONSUBMIT="return ValidateData();"> <input type="Submit" name="Submit" value="Save" >
7
3788
by: bill | last post by:
Is there any way to make a link (as marked by an <A>-tag, that is), behave exactly like a submit button? Many thanks! -bill
36
72049
by: spence | last post by:
Hi All How do I make it so that when a user clicks in a search text field, the default entry (in this case "Search") is removed automatically - they are then faced with a blank search box and can type straight away Thanks in advance
9
2219
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see) in page_load, or elsewhere, that says page.validate, no control says "causesvalidation=true", and the AutoEventWireup is set to false. So I would think that the control's server event function would NOT execute, but it does execute right after...
2
1517
by: simbarashe | last post by:
Hie Could someone please help me I'm trying to make a back button and I'm trying not to make the button a submit button. The action or the redirection to another page is done using php and my code is as follows: <link href="css/jobSheet.css" rel="stylesheet" type="text/css" /> <?php session_start(); ?>
10
1405
by: chadsspameateremail | last post by:
I first should list my background and that is that I'm new to PHP. I would like to be able to have an HTML form where there is a list that you choose from. Depending on what item is chosen in the list different HTML is displayed somewhere else on the page. I know this might be possible by adding a submit button and reloading the page. But is there a way to do it without the submit button? I know that Java might be able to accomplish...
1
6247
by: abcdriver | last post by:
Later edit: Too complex: The only thing I should know is: The submit button's NAME (and value) will only be sent if that particular button was used to submit the form, so you should be able to check that in the server side script. Rest is history:
9
1965
by: tvnaidu | last post by:
This is just small plain HTML program wtote manually (since I am new to web programming, may be some tools I can use I think), this program loaded onto microcontroller with small foot print web server, when program prints, half-way it prints, then it struck, any issue with this?. when user clicks "submit" again it loaded same page. but it sends some sytring to server (plug1=ON&......), that string will be processed inside server. any open...
0
8404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8931
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8680
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6238
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.