Jump to content

vbcoach

Members
  • Posts

    123
  • Joined

  • Last visited

Everything posted by vbcoach

  1. FIXED! Just needed to do a </span> and I now have what I needed! Thanks for the refresher team! Much appreciated!
  2. Ok, reloaded the code, now works BUT ***EVERYTHING*** past is now in red. I only wanted the results "(Locked)" to be in red. Nothing else. Were getting close. Help?
  3. UNFORTUNATELY, no working if($team["locked"] == 1) { echo "<span style='color:red;'>(locked)</span>"; else { echo " "; } echo "<br>"; I get this error: Parse error: parse error, unexpected T_ELSE in E:\... php on line 61
  4. Ok, I understand that. but when I tried, I received an error. Do I wrap it inside the quotes? Can you give me an example please? Thanks a bunch
  5. Hello. Racking my brains here, having trouble with this. Running a sports league, trying to get the output of one variable at a different font color OR insert a simple check mark graphic. Either way I am stuck. I am a bit out of practice here. Here is the code. Where is says echo ( Locked) is where I would like to either have locked in a color, say green or red - or insert check mark symbol. <?php $last = -1; while($team = mssql_fetch_assoc($res)) { if ($last != $team['l_id']) { $last = $team['l_id']; echo "<br><span class=\"dk_greyTxt\" style=\"font-size: 14px\"><strong>$team[night] night, $team[type] $team[size]s $team[division]</strong></span><br><br>"; } echo "<strong>$team[teamname] - ($team[shirtcolor] shirts)</strong><br> RegDate: $team[reg_start]<br>RegDone: $team[reg_done]"; $cpt = mssql_query("SELECT firstname, lastname, shirtsize, feepaid, feememo FROM captain WHERE c_id = $team[captain]",$conn); $c = mssql_fetch_assoc($cpt); if($team["locked"] == 1) { echo " (Locked)"; } else { echo " "; } echo "<br>";
  6. I find it amazing that not one single person can assist with this issue. I am sure the MsSql query is correct. It has to be in the PHP. I suspect my issue is somewhere in this statement. Would any body care to take a crack at this?
  7. Hello. Have an issue that has been bugging me for a couple of weeks now that I am just not figuring out. I have a sports league site that has multiple leagues and divisions. I have a looping statement that queries the leagues, returns the leagues (nights and divisions) with the number of those teams that are paid and also "locked in". See screenshot #1 attached. I have 4 queries written that are working properly when run from Sql Management Studio with the correct results displayed. $query2 = "SELECT l_id, COUNT(*) as num_teams FROM league as l, team WHERE league = l_id AND reg_done != '' GROUP BY l_id,type,size,l.division,night ORDER BY l_id"; $paidTeams = mssql_query($query2,$conn); $query3 = "SELECT l.type, l.[size], l.division, l.l_id, l.[session], COUNT(*) AS num_teams FROM league as l, team WHERE team.league = l.l_id AND (l.[session] = 'Summer') GROUP BY l.l_id, l.type, l.[size], l.division, l.night, l.[session] ORDER BY l.l_id"; $leagues2 = mssql_query($query3,$conn); $query4 = "SELECT l.type, l.[size], l.division, l.l_id, l.[session], COUNT(*) AS num_teams FROM league as l, team WHERE team.league = l.l_id AND (l.[session] = 'Summer') AND reg_done != '' GROUP BY l.l_id, l.type, l.[size], l.division, l.night, l.[session] ORDER BY l.l_id"; $paidTeams2 = mssql_query($query4,$conn); $query5 = "SELECT l.type, l.[size], l.division, l.l_id, l.[session], COUNT(*) AS num_teams FROM league as l, team WHERE team.league = l.l_id AND (l.[session] = 'Summer') and team.locked = '1' GROUP BY l.l_id, l.type, l.[size], l.division, l.night, l.[session] ORDER BY l.l_id"; $lockedteams = mssql_query($query5,$conn); These results display correctly in MsSql, but not on my page. No error is generated, just no results displayed, so I must concede that my code is wrong. I could use your help discovering where my mistake is, and correct it. There are currently 3 "locked in" teams: 2 in M4A Division and 1 in M4B Division. Here is my PHP code: <?php $paidt2 = mssql_fetch_assoc($paidTeams2); $lockedt = mssql_fetch_assoc($lockedteams); while($row = mssql_fetch_assoc($leagues2)) { ?> <tr> <td><?php echo "$row[type] $row[size] $row[division]" ?></td> <td><div align="center"><?php echo $row['num_teams']; ?></div></td> <td><div align="center"> <?php if($row['l_id'] == $paidt2['l_id']) { echo "<strong> $paidt2[num_teams]</strong>"; $paidt2 = mssql_fetch_assoc($paidTeams2); $lockedt = mssql_fetch_assoc($lockedteams); } else echo '-'; ?> </div></td> <td><div align="center"> <?php if($row['l_id'] == $lockedt['l_id']) { echo "<strong> $lockedt[num_teams]</strong>"; $paidt2 = mssql_fetch_assoc($paidTeams2); $lockedt = mssql_fetch_assoc($lockedteams); } else echo '-'; ?> </div></td> <td width="10"> </td> </tr> <?php } ?> Many thanks for your assistance! [attachment deleted by admin]
  8. I can't believe not one person can help me with this sql query?
  9. Hello and thanks for your help. I have a sports league database that contains 3 tables: Team, Captain, and Player. I am trying to order t-shirts for all captains and players for this league. I did not create this database. Here's the dilema; The TEAM table contains the shirt color for the team (column name is 'shirtcolor') The CAPTAIN table contains the team captain and his shirt size (column name is 'shirtsize') and finally the PLAYER table (column name is 'pshirt') for the player shirt size. What I need to do is create a query to gather and display all the shirts, broken down by color and size for both the captains and players. The creator of the database wrote a query a while back for the players shirts that works. Here is the code for the players shirts that works: SELECT t.shirtcolor, p.pshirt, COUNT(t.shirtcolor) as shirt_count FROM team as t, player as p WHERE t.t_id = p.team AND t.locked = 1 GROUP BY t.shirtcolor, p.pshirt ORDER BY shirtcolor, pshirt What I need to do is to come up with a query for ALL shirts (not just the players) and dawg-gone it, I just can't figure out how to do it. Can anyone help? Thanks in advance!
  10. That did it. Not sure why the variable had to be (re)called, but thanks a bunch!
  11. I hate to be a pain, but again it is defined here in access.php <?php mssql_close($conn); exit; } $SBteam = mssql_fetch_assoc($res); $_SESSION['id'] = $SBteam['player_id']; $_SESSION['playername'] = $SBteam['playername'];
  12. Sure there is. In the included code: access.php Here's the flow: *Index page allows player to enter his userid and password. *Access.php processes that information, sets $_Post variables to pass to *viewplayer.php which allows player to view his current information. *editplayer.php allows a player to change certain fields. *updateplayer.php processes those changes, then updates the variables. It's at this point where the "id" is not being found. If I do a $vars = get_defined_vars(); print_r($vars); it does show an "[id] = 1" which is what the player_id is supposed to be. I am confused.
  13. Here you go. <?php require_once('access.php'); $info = $_SESSION; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Baltimore Beach Control Panel</title> <link rel="stylesheet" href="../../cp/cpanel.css" type="text/css"> <script language="javascript"> </script> <style type="text/css"> <!-- .style2 { font-size: 18px; font-weight: bold; } .style5 {font-size: 14; font-weight: bold; } .style7 {font-size: 14px; } --> </style> </head> <body> <p><img src="images/trinity1.jpg" width="336" height="87"></p> <table width="788" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="58%" height="340"><form name="updtplyr" action="updatePlayer.php" method="post"> <table width="98%" border="0" cellpadding="2" cellspacing="0" class="grey2px"> <tr> <td colspan="3" class="dk_greyTxt"><h3 class="style2">Player's Information</h3></td> </tr> <tr> <td width="30%" class="dk_greyTxt"><span class="style5">Name</span></td> <td width="3%"> </td> <td width="67%"><?php echo $info['playername']; ?> </td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">Home Phone</span></td> <td> </td> <td><input type="text" name="homephone" id="homephone" value="<?php echo $info['homephone'] ?>"> <br></td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">Cell Phone</span></td> <td> </td> <td><input type="text" name="cellphone" id="cellphone" value="<?php echo $info['cellphone'] ?>"></td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">E-mail</span></td> <td> </td> <td><input type="text" name="email" id="email" value="<?php echo $info['email'] ?>"></td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">Jersey</span></td> <td> </td> <td><?php echo $info['jersey'] ?></td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">Position 1</span></td> <td> </td> <td><input type="text" name="position1" id="position1" value="<?php echo $info['position1'] ?>"></td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">Position 2</span></td> <td> </td> <td><input type="text" name="position2" id="position2" value="<?php echo $info['position2'] ?>"></td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">Position 3</span></td> <td> </td> <td><input type="text" name="position3" id="position3" value="<?php echo $info['position3'] ?>"></td> </tr> <tr> <td class="dk_greyTxt"><span class="style5">Comments</span></td> <td rowspan="2" valign="top"> </td> <td rowspan="2" valign="top"><textarea name="comments" id="comments" cols="45" rows="2"><?php echo $info['comments'] ?></textarea> </td> </tr> <tr> <td class="dk_greyTxt"> </td> </tr> <tr> <td class="dk_greyTxt"> </td> <td> </td> <td><input type="submit" name="updateplayerinfo" id="updateplayerinfo" value="Update Player Information"> </td> </tr> </table> <br> </form> </td> <td width="42%" align="center" valign="top"><form name="uAv" action="updateAvailability.php" method="post" > <table width="310" border="0"> <tr> <td colspan="10" bgcolor="#D1E39B"><div align="center" class="style2">Schedule Availability</div></td> </tr> <tr> <td width="59" class="menu"><div align="center" class="style7">5/1</div></td> <td width="58" class="menu"><div align="center" class="style7">5/8</div></td> <td width="58" class="menu"><div align="center" class="style7">5/15</div></td> <td width="58" class="menu"><div align="center" class="style7">5/22</div></td> <td width="55" class="menu"><div align="center" class="style7">5/29</div></td> </tr> <tr> <td><div align="center"> <select name="week6" id="week2"> > <option value="" <?php if($info['week1'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week1'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week1'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week6" > <option value="" <?php if($info['week2'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week2'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week2'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week6" id="week6"> <option value="" <?php if($info['week3'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week3'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week3'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week6" id="week7"> <option value="" <?php if($info['week4'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week4'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week4'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week6" id="week8"> <option value="" <?php if($info['week5'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week5'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week5'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> </tr> </table> <p> <table width="310" border="0"> <tr> <td colspan="10" bgcolor="#D1E39B"><div align="center" class="style2">Schedule Availability</div></td> <tr> <td width="59" class="menu"><div align="center" class="style7">6/5</div></td> <td width="58" class="menu"><div align="center" class="style7">6/12</div></td> <td width="58" class="menu"><div align="center" class="style7">6/19</div></td> <td width="58" class="menu"><div align="center" class="style7">6/26</div></td> <td width="55" class="menu"><div align="center" class="style7">7/10</div></td> </tr> <tr> <td><div align="center"> <select name="week6" id="week9"> <option value="" <?php if($info['week6'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week6'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week6'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week7" id="week10"> <option value="" <?php if($info['week7'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week7'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week7'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week8" id="week11"> <option value="" <?php if($info['week8'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week8'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week8'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week9" id="week12"> <option value="" <?php if($info['week9'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week9'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week9'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> <td><div align="center"> <select name="week10" id="week13"> <option value="" <?php if($info['week10'] == NULL) echo 'selected'; ?>>?</option> <option value="Yes" <?php if($info['week10'] == 'Yes') echo 'selected'; ?>>Yes</option> <option value="No" <?php if($info['week10'] == 'No') echo 'selected'; ?>>No</option> </select> </div></td> </tr> </table> <p> <input type="submit" name="update" id="update" value="Update Availability"> <br> </p> </form> </form></td> </tr> </table> <p> </p> <p> </p> </body> </html> ============ This is the form that calls the update to be set in Sql database=============== ============= Now below is the ACCESS form that is used, and defines the variables ========== <?php /* This document will be used to manage the Trinity SB team sessions when they login This should be placed at the top of each page in the /trinitySB directory */ session_start(); if(!isset($_SESSION['id']) && !isset($_POST['unique'])) { //build login page again ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Baltimore Beach Control Panel</title> <link rel="stylesheet" href="../cp/cpanel.css" type="text/css"> </head> <body> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3"><img src="../cp/images/BBV_CP_top.jpg" width="800" height="200"></td> </tr> <tr> <td> </td> <td><br> <br> <br> <form name="bbv_login_form" action="login.php" autocomplete = "false" method="post"> <table width="350" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="4"><img src="../cp/images/login_top.jpg" width="350" height="25"></td> </tr> <tr> <td width="5" rowspan="7" class="tableltBg"></td> <td colspan="2" align="center"><strong><em>Sorry: You must first login to use this feature </em></strong></td> <td width="5" rowspan="7" class="tableRtBg"></td> </tr> <tr> <td align="right" class="dk_greyTxt"> </td> <td> </td> </tr> <tr> <td width="100" align="right" class="dk_greyTxt"><strong>username: </strong></td> <td width="240"> <input name="unique" type="text" id="unique"></td> </tr> <tr> <td width="100"> </td> <td width="240"> </td> </tr> <tr> <td width="100" align="right" class="dk_greyTxt"><strong>password: </strong></td> <td width="240"> <input name="pword" type="password" id="pword"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td width="100"> </td> <td width="240"><input name="Submit" type="submit" class="button" value="Login"></td> </tr> <tr> <td colspan="4" class="tableFoot"></td> </tr> </table> </form> </td> <td> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </body> </html> <?php exit; } if(isset($_POST['pword'])) { $conn = mssql_connect ("localhost", "bbpublic", "********") or die ('I cannot connect to the database because: ' . mssql_error()); $un = $_POST['unique']; $pw = $_POST['pword']; mssql_select_db("baltimorebeach"); $sql = "SELECT t.*, username, password FROM trinitySBteam as t WHERE username='$un' AND password='$pw'"; $res = mssql_query($sql,$conn); if(mssql_rows_affected($conn) !== 1) { //Login unsuccessful build nessecery page ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Trinity Softball 2010 Control Panel</title> <link rel="stylesheet" href="../cp/cpanel.css" type="text/css"> </head> <body> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3"><img src="../cp/images/BBV_CP_top.jpg" width="800" height="200"></td> </tr> <tr> <td> </td> <td><br> <br> <br> <form name="bbv_login_form" action="" autocomplete = "false" method="post"> <table width="350" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="4"><img src="../cp/images/login_top.jpg" width="350" height="25"></td> </tr> <tr> <td width="5" rowspan="7" class="tableltBg"></td> <td colspan="2" align="center"><strong><em>Error: username/password combination not found </em></strong></td> <td width="5" rowspan="7" class="tableRtBg"></td> </tr> <tr> <td align="right" class="dk_greyTxt"> </td> <td> </td> </tr> <tr> <td width="100" align="right" class="dk_greyTxt"><strong>username: </strong></td> <td width="240"> <input name="unique" type="text" id="unique"></td> </tr> <tr> <td width="100"> </td> <td width="240"> </td> </tr> <tr> <td width="100" align="right" class="dk_greyTxt"><strong>password: </strong></td> <td width="240"> <input name="pword" type="password" id="pword"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td width="100"> </td> <td width="240"><input name="Submit" type="submit" class="button" value="Login"></td> </tr> <tr> <td colspan="4" class="tableFoot"></td> </tr> </table> </body> </html> <?php mssql_close($conn); exit; } $SBteam = mssql_fetch_assoc($res); $_SESSION['id'] = $SBteam['player_id']; $_SESSION['playername'] = $SBteam['playername']; $_SESSION['homephone'] = $SBteam['homephone']; $_SESSION['cellphone'] = $SBteam['cellphone']; $_SESSION['email'] = $SBteam['email']; $_SESSION['jersey'] = $SBteam['jersey']; $_SESSION['position1'] = $SBteam['position1']; $_SESSION['position2'] = $SBteam['position2']; $_SESSION['position3'] = $SBteam['position3']; $_SESSION['week1'] = $SBteam['week1']; $_SESSION['week2'] = $SBteam['week2']; $_SESSION['week3'] = $SBteam['week3']; $_SESSION['week4'] = $SBteam['week4']; $_SESSION['week5'] = $SBteam['week5']; $_SESSION['week6'] = $SBteam['week6']; $_SESSION['week7'] = $SBteam['week7']; $_SESSION['week8'] = $SBteam['week8']; $_SESSION['week9'] = $SBteam['week9']; $_SESSION['week10'] = $SBteam['week10']; $_SESSION['week11'] = $SBteam['week11']; $_SESSION['week12'] = $SBteam['week12']; $_SESSION['comments'] = $SBteam['comments']; mssql_close($conn); } ?> There is one other page that simply allows the player to view his current information. Does this help?
  14. You are right! The variable is not there. However when I do a vardump, the "id" exists and returns the correct value. Any thoughts?
  15. Hello. Have a simple site that takes softball player names and after successful logging in, give them to edit some basic information, like home and cell phone, comments, etc.. Everything appears correct, yet I am getting an undefined index MsSql error, yet when I do a variable dumb, the index appears. Not sure what I am doing wrong. <?php require_once('access.php'); $conn = mssql_connect ("localhost", "bbpublic", "hdyet65e42") or die ('I cannot connect to the database because: ' . mssql_error()); mssql_select_db("********"); $vals = $_POST; $sql = "UPDATE trinitySBteam SET homephone='$vals[homephone]',cellphone='$vals[cellphone]',email='$vals[email]',position1='$vals[position1]',position2='$vals[position2]',position3='$vals[position3]',comments='$vals[comments]' WHERE player_id = $vals[id]"; mssql_query($sql, $conn); mssql_close($conn); //Update Session Variables $_SESSION['homephone'] = $vals['homephone']; $_SESSION['cellphone'] = $vals['cellphone']; $_SESSION['email'] = $vals['email']; $_SESSION['position1'] = $vals['position1']; $_SESSION['position2'] = $vals['position2']; $_SESSION['position3'] = $vals['position3']; $_SESSION['comments'] = $vals['comments']; header("Location: viewplayer.php"); ?> Yet I get this error after running... Notice: Undefined index: id in E:\Web Server\baltimorebeach_com\htdocs\trinitySB\updatePlayer.php on line 15 Warning: mssql_query(): message: Line 1: Incorrect syntax near '='. (severity 15) in E:\Web Server\baltimorebeach_com\htdocs\trinitySB\updatePlayer.php on line 16 Warning: mssql_query(): Query failed in E:\Web Server\baltimorebeach_com\htdocs\trinitySB\updatePlayer.php on line 16 Warning: Cannot modify header information - headers already sent by (output started at E:\Web Server\baltimorebeach_com\htdocs\trinitySB\updatePlayer.php:15) in E:\Web Server\baltimorebeach_com\htdocs\trinitySB\updatePlayer.php on line 28
  16. I have spent nearly a week "trying" this code of Antrum's. Once again it still does not work. If it worked, then I might be able to adapt it to my needs. However I do not understand either CDONTS or Antrum's code or what is wrong. There is an error in the "try" statement.
  17. Matthew, that's the problem. I do not know how to do that with CDONTS! No idea whatsoever. That is why I am here. Really needing some assistance here.
  18. Ok, let me start over. Again, a registration page for a sports website (http://www.baltimorebeach.com/registration/teamregistration2010.php) is used for team captains to register their team. When complete, it goes to a processing page when the input is dumped into the database and a receipt page is displayed on the screen, which the captain is instructed to print out for his records as it contains all of his team's information, including his username and password to access the site (which of course the 'male' captains never do). We get dozens of emails a week asking for UN and PW requests because they were not sent a confirmation email. Duh. We haven't created one. yes I could create a reset password page, but it would be so much easier just to send the team captains a copy of their information via when registering. My hope is to take this "information" page and send it to the team captain via the email address he entered for the captain. My code is this: <?php if($_POST) { foreach ($_POST as $k=>$v) { $t = stripslashes($v); $t = str_replace("'",'′',$t); $vals[$k] = $t; } //Connect to Database $conn = mssql_connect ("localhost", "********", "********") or die ('I cannot connect to the database because: '); mssql_select_db("baltimorebeach"); $teamname = "SELECT t_id FROM team WHERE league = '$vals[league]' AND teamname='$vals[teamname]'"; $tres = mssql_query($teamname); if(mssql_rows_affected($conn) != 0) { $lsql = "SELECT * FROM league WHERE active = 1 AND [session] = 'Spring' ORDER BY l_id"; $lres = mssql_query($lsql,$conn); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>2010 Team Registration Complete</title> <link rel="stylesheet" href="dh2styles.css" type="text/css"> <script language="javascript"> function isEmail(str) { // are regular expressions supported? var supported = 0; if (window.RegExp) { var tempStr = "a"; var tempReg = new RegExp(tempStr); if (tempReg.test(tempStr)) supported = 1; } if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)"); var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$"); return (!r1.test(str) && r2.test(str)); } function validate (theForm) { var errStr = ""; if(theForm.teamname.value == '') { errStr += "Team name not entered\n"; } if(theForm.league.value == -1) { errStr += "Please select a league in which to participate\n"; } if(theForm.shirtsize.value == -1) { errStr += "Please select a t-shirt color\n"; } if(!isEmail(theForm.cpt_email.value)) { errStr += "Please enter a valid e-mail address\n"; } if(theForm.cpt_first.value=='' || theForm.cpt_last.value=='') { errStr += "Captain's name incomplete\n"; } if(theForm.cpt_address.value=='' || theForm.cpt_city.value==''|| theForm.cpt_state.value== -1 || theForm.cpt_zip.value=='') { errStr += "Captain's address incomplete\n"; } if(theForm.cpt_shirtsize.value == -1) { errStr += "Please select a shirt size for the captain"; } if(errStr != "") { alert("The following problems have occurred\n\n"+errStr); return false; } return true; } </script> <style type="text/css"> <!-- .style8 { color: #FF0000; font-size: 18px; } .style9 {color: #000000} a:link { color: #000000; } a:visited { color: #000000; } --> </style> </head> <body> <h4 align="center"> <img src="http://www.baltimorebeach.com/images/oops3.gif" alt="Oops! Team Name Already In Use" /> </h4> <h4 align="center" class="style5"><span class="style4">Team name </span><strong><em>"<span class="style7 style8"><?= $vals['teamname'] ?></span>"</em> already taken for this league! Please selecet a different name</strong>. </h4> <h4 align="center"><p align="center" class="style9">Please press <a href="javascript:history.back()">Back</a> on your browser and choose a different team name </p> </h4> </body> </html> <?php mssql_close($conn); exit; }//if team name already exists //League Info $leagueId = $vals['league']; $leagueRes = mssql_query("SELECT * FROM league WHERE l_id = $leagueId",$conn); $lSize = mssql_fetch_assoc($leagueRes); //Create the captain $ln = strtolower(substr($vals['cpt_first'],0,1).str_replace("'","",$vals['cpt_last'])); $loginSQL = "SELECT COUNT(*) FROM captain WHERE username LIKE '$ln%'"; $lres = mssql_query($loginSQL,$conn); $count = mssql_fetch_row($lres); //login is first initial + last name $login = strtolower(substr($vals['cpt_first'],0,1).str_replace("'","",$vals['cpt_last'])).substr($lSize['type'],0,1).$lSize['size'].$lSize['division']; if($count[0] > 0) { $login = strtolower(substr($vals['cpt_first'],0,1).str_replace("'","",$vals['cpt_last']).$count[0].substr($lSize['type'],0,1).$lSize['size'].$lSize['division']); } $password = strtolower(substr($vals['cpt_first'],0,1).substr($vals['cpt_last'],0,1).substr($vals['cpt_phone'],-4)); $cpt_sql = "INSERT INTO captain (username,password,firstname,lastname,address,city,state,zip,email,phone,shirtsize,returningteam,rteamname) VALUES ('$login','$password','$vals[cpt_first]','$vals[cpt_last]','$vals[cpt_address]','$vals[cpt_city]','$vals[cpt_state]','$vals[cpt_zip]','$vals[cpt_email]','$vals[cpt_phone]','$vals[cpt_shirtsize]','$vals[returningteam]','$vals[rteamname]')"; //run captain query $query = mssql_query($cpt_sql,$conn); //Find the captains id # for the team information $query = mssql_query("SELECT c_id FROM captain ORDER BY c_id DESC;",$conn); $qRes = mssql_fetch_assoc($query); $cptId = $qRes['c_id']; //$cptId = 1; //---------- $getip = $_SERVER['REMOTE_ADDR']; //Create the team $team_sql = "INSERT INTO team (teamname,shirtcolor,league,captain,venue,ip) VALUES ('$vals[teamname]','$vals[shirtcolor]','$leagueId','$cptId','$vals[venue]','$getip')"; //echo $team_sql; //run team query $query = mssql_query($team_sql,$conn); //find team id for players $query1 = mssql_query("SELECT t_id FROM team ORDER BY t_id DESC;",$conn); $qRes = mssql_fetch_assoc($query1); $teamId = $qRes['t_id']; //------------------ //build players /* loop through all ten possible players listed and check to see if the name field has at least 2 characters. If it does then we will grab the other 3 bits of information and add the player to the database. */ $players = ''; $pCount = 1; $members = $leagueId == 31 ? 6:11; for($i =1; $i <= $members; $i++) { if(strlen($vals['player'.$i.'_name']) > 2) { $pName = $vals['player'.$i.'_name']; $pEmail = $vals['player'.$i.'_email']; $ppShirt = $vals['player'.$i.'_shirt']; $pCount ++; $p_sql = "INSERT INTO player (name,email,team,pshirt) VALUES ('$pName','$pEmail','$teamId','$ppShirt')"; $query = mssql_query($p_sql,$conn); $players .= "$pName - $ppShirt <br />\n"; } } //------------- mssql_close($conn); //calculate Fees $size = $lSize['size']; switch($size) { case 2: $base = 150; $size = 3; break; case 4: $base = 330; $size = 6; break; case 6: $base = 550; $size = 10; break; default: die ("invalid league size"); }; $earlyTeam = $base; { $e_each = $earlyTeam / $pCount; $lateTeam = $earlyTeam * 1.10; $l_each = $lateTeam / $pCount; } //POST everything else - time to display more variables echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>2010 Summer Session Team Registration Confirmation</title> <link rel="stylesheet" href="jahstyles.css" type="text/css"> </head> <body> '; echo " <div id=\"banner\"> <img border=\"0\" src=\"bbeachlogo.jpg\"> <h3>Team $vals[teamname] Registration for \"Spring\" Leagues 2010!</h3> <p <font face=\"Comic Sans MS\">Thank you for registering with Baltimore Beach, please <strong><a href=\"javascript:window.print()\">PRINT</a></strong> this page for your records.<br> <strong>Registration is not considered complete until team fees have been paid.</strong><br> Please send one check for team fees, as captain, this responsibility falls to you.<br><br> To view all other teams that have registered in your league <a href=\"http://www.baltimorebeach.com/spring2010leagueinfo.php?l=$lSize[l_id]\">click here</a> <h2><b><u>Team Captain Info:</u></b></h2> <strong>Name</strong>: $vals[cpt_first] $vals[cpt_last]<br> <strong>Address</strong>: $vals[cpt_address] $vals[cpt_city], $vals[cpt_state] $vals[cpt_zip]<br> <strong>Email</strong>: $vals[cpt_email]<br> <strong>Shirt</strong>: $vals[cpt_shirtsize]<br> <strong>Login</strong>: $login<br> <strong>Password</strong>: $password<br> Captain's web page is: <a href=\"http://www.baltimorebeach.com/cp\">http://www.baltimorebeach.com/cp</a> <h2><b><u>Team Info:</u></b></h2> <strong>BBV League</strong>: Spring $lSize[night] $lSize[type] $lSize[size] $lSize[division]<br> <strong>Team Name</strong>: $vals[teamname]<br> <strong>T-Shirt Color</strong>: $vals[shirtcolor]<br> <strong>No. of Players</strong>: $pCount<br> <strong>Team Fees Due</strong>: \$$earlyTeam<br> </p> <p> <h2><b><u>Players / Shirt Sizes:</u></b></h2> $players </p> <p> <p><span class=\"style99\">Make (one) team registration check payable to</span><strong>:</strong> <span class=\"style34\">Baltimore Beach</span> <br /> <span class=\"style98\">*Please enter team name, league night & division on memo line</span></p> <p align=\"left\"><span class=\"style99\">Send to</span><strong>:</strong> <span class=\"style33\">Baltimore Beach<br /> 1317 S. Hanover Street <br /> Baltimore, MD 21230</span></p> <p align=\"left\"><span class=\"style33\">*** League payments now accepted via PayPal ***</span><br> <a href=\"http://www.baltimorebeach.com/paypal.htm\" target=\"_self\"><img src=\"http://www.baltimorebeach.com/images/paypal.jpg\" width=\"150\" height=\"52\" hspace=\"61\" border=\"0\" longdesc=\"http://www.baltimorebeach.com/images/paypal.jpg\"></a><br> <img src=\"http://www.baltimorebeach.com/images/paypal2.jpg\" width=\"148\" height=\"17\" hspace=\"62\" vspace=\"0\" longdesc=\"http://www.baltimorebeach.com/images/paypal2.jpg\"></p> </div> </body> </html> "; } /* */ ?> Please keep in mind that I am not an experienced PHP programmer. I inherited this already-existing project. Thanks in advance for any assistance. My only option for sending email via the hosting provider is using CDONTS (CDO)
  19. Don't understand any of it. The code antrum gave me doesn't work. I uploaded the code to my web site for a test and get an unexpected { error. Also, antrum's code, from what I can gather is useful for a contact form. I do not see how I can take existing webpage and email it using what he wrote. So until I can get the code to work and see exactly what it is doing, I am still at square one unfortunately.
  20. This is what the hosting service provided me as an example. I could use some help with this. Dim objMail Set objMail = Server.CreateObject("CDONTS.NewMail") objMail.From = address_email objMail.Subject = "xxx" objMail.To = "xxx@domain.com" objMail.Body = msg objMail.Send set objMail = nothing address_email is a variable from your form data, the person filling out the form. objMailTo would be you. It can even handle the additional objMail.Cc variable. You can google the code for further syntax. Msg is a variable you create for format the email message you want to send IN the email. Here is an example. Dim msg msg = "THE FOLLOWING PERSON HAS REQUESTED TO BE ADDED TO YOUR MAILING LIST:" & chr(10) & chr(10) msg = msg & "EMAIL: " & address_email & chr(10) & chr(10) & chr(10) msg = msg & "--------------------------------" & chr(10) msg = msg & "http://www.domain.com" & chr(10) msg = msg & "--------------------------------" & chr(10)
  21. Hey great example, atrum. Much appreciated. However I probably should have been more clear. I have a registration form that a user fills out. When complete, this registration form is processed and the information is entered into the database and a "receipt" page is displayed with the users inputted information. What I am looking for is a way to (also) send that information to the user email address via email using PHP. My hosting provider says this can be done with CDO. (The PHP mail() function is apparently disabled for security purposes) The hosting provider sent me an example, but their example is a vbscript. Not sure if that helps me in PHP. I need to basically take the whole web page and dump it into an email to the end user.
  22. My ISP / Webhost says mail can be sent from their server using CDO. However the code they gave me is written in ASP and I use PHP for our site. Can CDO be used to send mail via PHP?
  23. Oh thank you so very much! I knew it was easy, but at 1am and brain-fried just couldn't grasp it. Mucho Gracias!
  24. Ok, so far so good. However my drop down menu is dynamically created. I want to take the variable $lrow['l_id'] and add it to the end of http://www.mywebsite.com/info.php?l= then launch URL. The example you gave me has static addresses and I cannot figure out how to add my website url to the script. Any thoughts?
×
×
  • 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.