Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 11-16-2009, 02:14 AM
  #1
miko0909
Novice (Level 1)
 
Join Date: Nov 2009
Posts: 2
iTrader: (0)
miko0909 is an unknown quantity at this point
Adding a Submit button so info is emailed to me - HTML Help

Below is the current code I have. I havent coded in html for 6 years. Can someone either add or show me how to add a submit button that emails the info on that page to my email. I have been asked by a friend to build him a website, and right now I am a total faliure. I also need a reset button on the site that clears the info in the boxes. If someone could either just do it for me, or show me how i'd really apreciate it. Thanks everyone.

Mike



<html>

<head>
<title>Player Signup</title>
<script>
window.windowname= "Add Form Page"
orpage= window.windowname
function startForm(form) {
nname= form.fname.value;
nname= ((nname== "") ? nname= "" : nname= " NAME=" + nname);
ntarget= form.ftarget.value;
ntarget= ((ntarget== "") ? ntarget= "" : ntarget= " TARGET=" + ntarget);
nenctype= form.fenctype.value;
nenctype= ((nenctype== "") ? nenctype= "" : nenctype= " ENCTYPE=" + nenctype);
whtml= form.HTML.value;
mymethods= form.chosenmethod.selectedIndex;
mymethodsarray= new Array();
mymethodsarray[0] = "";
mymethodsarray[1] = "GET";
mymethodsarray[2] = "POST";
mymethod= mymethodsarray[mymethods];
mymethod= ((mymethod== "") ? mymethod= "" : mymethod= " METHOD=" + mymethod);
myaction= form.chosenaction.value;
myaction= ((myaction== "") ? myaction= "" : myaction= " METHOD=\"" + myaction + "\"");
nhtml= whtml + "\r <FORM" + nname + myaction + mymethod + ntarget + nenctype + ">";
form.HTML.value = nhtml;
}
function endForm(form) {
whtml= form.HTML.value;
nhtml= whtml + "\r </FORM>";
form.HTML.value = nhtml;
}
function newItem(txtarea, form) {
addbre= (form.addbr.checked== true) ? addbre=form.addbr.value : addbre= "";
crows= form.chooserows.value;
ccols= form.choosecols.value;
crows= ((crows== "") ? crows= "" : crows= " ROWS=" + crows);
ccols= ((ccols== "") ? ccols= "" : ccols= " COLS=" + ccols);
ntoit= form.choosevalue.value;
cname= form.choosename.value;
cname= ((cname== "") ? cname= "" : cname= " NAME=\"" + cname + "\"");
ctype= form.choosetype.selectedIndex;
ctypearray= new Array();
ctypearray[0] = "text";
ctypearray[1] = "radio";
ctypearray[2] = "checkbox";
ctypearray[3] = "button";
ctypearray[4] = "hidden";
ctypearray[5] = "reset";
ctypearray[6] = "submit";
ctypearray[7] = "password";
ntoit= ((0 < ctype) ? ntoit= ntoit : ntoit= "");
ntoit= ((ctype > 2) ? ntoit= "" : ntoit= ntoit);
check= form.checks.value
checktf= form.checks.checked
check= ((ctype== 2) | (ctype== 1) ? check= check : check= "")
check= (checktf== true) ? check= check : check= "";
cvalue= form.choosevalue.value;
cvalue= ((cvalue== "") ? cvalue= "" : cvalue= " VALUE=\"" + cvalue + "\"");
csize= form.choosesize.value;
csize= ((ctype== 7) | (ctype== 0) ? csize= csize : csize= "")
csize= ((csize== "") ? csize= "" : csize= " SIZE=" + csize);
clength= form.chooselength.value;
clength= ((clength== "") ? clength= "" : clength= " MAXLENGTH=" + clength);
clength= ((ctype > 0) ? clength="" : clength= clength);
whtml= form.HTML.value;
ctype= " TYPE=\"" + ctypearray[ctype] + "\"";
nhtml= whtml + "\r <INPUT" + check + cname + ctype + cvalue + csize + clength + ">" + ntoit + addbre;
txtdsply= "Default Text"
nwhtml= whtml + "\r <TEXTAREA" + cname + crows + ccols + ">" + txtdsply + "</TEXTAREA>" + addbre;
nhtml= ((txtarea== 8) ? nhtml= nwhtml : nhtml= nhtml);
form.HTML.value = nhtml;
}
function genNewPage(form) {
header= "<HTML>\r<HEAD>\r<TITLE>Generated Form</TITLE>\r</HEAD>\r\r<BODY BGCOLOR=\"white\">";
newhtml= form.HTML.value;
footer= "</BODY>\r</HTML>";
newpage= header + "\r\r" + newhtml + "\r\r" + footer;
preWin= open("", "Preview", "width=400,height=400,status=no,toolbar=no,menubar=no");
preWin.document.open();
preWin.document.write(newpage);
preWin.document.close();
}
</script>

<base target="leftframe">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-image: url(backgroundice.jpg);
}
-->
</style></head>

<body BGCOLOR="#ffffff" link="#CC0033" vlink="#333399" alink="#FF0000" <!--content start-->

<p align="center"><a href="home.html" ><img src="home.jpg" width="182" height="56" /></a><a href="dates.html"><img src="dates.jpg" width="182" height="56" /></a><a href="registration.html"><img src="register.jpg" width="182" height="56" /></a><a href="about.html"><img src="aboutus.jpg" width="182" height="56" /></a><a href="yourprogram.html"/a><img src="camps.jpg" width="182" height="56" /></a></p>


<table WIDTH="96%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
<tr>
<td WIDTH="100%"><form NAME="addform">
<p>Player Information</p>
<p>Name:&nbsp;<input NAME="pname" TYPE="text" size="20"><br>
Age:&nbsp;
<input TYPE="text" NAME="age" size="20"><br>
Last Team:&nbsp;
<input TYPE="text" NAME="lteam" size="20">
<br>
Level Played At (A1,A2,A3,C):
<input TYPE="text" NAME="level" size="20">
<br>
Stats:&nbsp;
<input type = "text" NAME="stats" size="20"><br>
Email:
<input TYPE="text" NAME="email" size="20">
<BR>
Home Phone:
<input TYPE="text" NAME="homephone" size="20">
<BR>
Cell Phone:
<input TYPE="text" NAME="cellphone" size="20">
<BR>
City of residence:
<input TYPE="text" NAME="city" size="20">
<BR>
Home orginization:
<input TYPE="text" NAME="orginization" size="20">
<BR>
What are your goals for the Upcoming Hockey Season?
<p>
<textarea NAME="sgoals" ROWS="10" COLS="45"></textarea>
<p>Who Refered you to us?
<input TYPE="text" NAME="referl" size="20">
<p>What are you hockey aspirations for the future?
<p>
<textarea NAME="hgoals" ROWS="10" COLS="45"></textarea>
<p>How Will you be paying? (Money order, Check preferred, Paypal also Avalible. Do NOT mail an envelope full of cash!)</p>
<p>
<input TYPE="text" NAME="paytype" size="20">
</p>
<p>&nbsp;</p>
<p>

</form>
</td>
</tr>
</table>
<!--content stop-->
</body>
</html>
miko0909 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-17-2009, 01:17 AM
  #2
Sawtooth500
Lord (Level 16)
 
Sawtooth500's Avatar
 
Join Date: Nov 2007
Location: Chicago, IL. USA
Posts: 588
iTrader: (0)
Sawtooth500 is on a distinguished road
1. Change your <form> tag to read:
<form name="addform" method="post">

2. Add the following php code before any other code:

PHP Code:
<?php
if($_POST){
    
$message '';
    foreach(
$_POST as $key => $value){
        
$message .= $key ": " $value "\n";
    }
       
$email 'insert email here';
       
$subject 'insert email subject here';
    
mail($email$subject$message);
}

?>
Put the email address you want to use and your subject line where it says to do so in the php code. Also, you'll need to be running this on a server that supports PHP and change your file extension to end in .php
__________________
-Taras Hryniw

http://www.waltonstreetwebdesign.com

Last edited by Sawtooth500 : 11-17-2009 at 01:19 AM.
Sawtooth500 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-20-2009, 10:17 AM
  #3
miko0909
Novice (Level 1)
 
Join Date: Nov 2009
Posts: 2
iTrader: (0)
miko0909 is an unknown quantity at this point
Do i place that in before my <HTML> Tag? and theres still no submit button.
miko0909 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-21-2009, 11:59 AM
  #4
bsxiong
Warning: hawt hawt
 
bsxiong's Avatar
 
Join Date: Jul 2004
Location: Twin Cities
Posts: 1,271
iTrader: (0)
bsxiong will become famous soon enough
why not just add an input type to a submit?
__________________
bsxiong is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 02:10 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.