-
Posts
129 -
Joined
-
Last visited
Everything posted by vbcoach
-
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.
-
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 = "[email protected]" 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)
-
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.
-
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?
-
Launching a link directly from a menu selection
vbcoach replied to vbcoach's topic in PHP Coding Help
Oh thank you so very much! I knew it was easy, but at 1am and brain-fried just couldn't grasp it. Mucho Gracias! -
Launching a link directly from a menu selection
vbcoach replied to vbcoach's topic in PHP Coding Help
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? -
Hello once again. From within a form I have a PHP call to a MsSql database for available leagues and returns some basic information. It's in a dropdown menu. What I would like to do is when a user makes a selection from that form, I would like this form to immediate launch either the results in the same page, or launch a link to a new page with the requested information. Attached is the code I am using. I am trying to avoid multiple key or mouse presses. Just select the league - and then go there. <label>List registered teams for <select name="league" tabindex="2" > <option value="" selected="selected">-- Select League --</option> <?php while ($lrow = mssql_fetch_assoc($lres)) { ?> <option value="<?php echo $lrow['l_id'];?>"><?php echo "$lrow[night] $lrow[type] $lrow's $lrow[division]"; ?></option> <?php } ?> Then I either want the results printed below the selection, or a new page launched to http://www.somewebsite.com/viewleague.php?l= <selected league ID goes here> Does this make sense?
-
Code to get IP address from user submitting form information
vbcoach replied to vbcoach's topic in PHP Coding Help
By the way, would this go on the front registration form, or the backend processing form? -
Code to get IP address from user submitting form information
vbcoach replied to vbcoach's topic in PHP Coding Help
Too easy - thanks! -
Hello. I have a sports web site that I have a team registration form for leagues signup. I am getting a single person submiting false teams daily that I have to manually remove. I do not want to place undue pressure on teams signing up, but do want to find the idiot trying to push Levitra and Viagra onto my site. Can someone help me with a code that will grab the users IP address that presses SUBMIT on the form? Once I have the IP, at least I can block that (for now). Right now this guy(?) is just a nuissance and not flooding my site (yet), so I think this action will work for the time being. Any help would be greatly appreciated.
-
Help with finding what variables have been passed...
vbcoach replied to vbcoach's topic in PHP Coding Help
Nope. And sorry for the attitude. It was nearly 4am here and I was brain-fried. I was looking for a statement that would print ALL the variables, their names and values. I finally found a code that worked via a google search. -
Help with finding what variables have been passed...
vbcoach replied to vbcoach's topic in PHP Coding Help
Someone please delete this post. No one is helping. -
Help with finding what variables have been passed...
vbcoach replied to vbcoach's topic in PHP Coding Help
That did not work like I expected. All I got returned was "Array ([phpSESSIONID]=>..." and a bunch of numbers. What I am looking for is a way to see what variables have been passed to this page, what the variable name is and it's resulting value. is this possible? -
Help with finding what variables have been passed...
vbcoach replied to vbcoach's topic in PHP Coding Help
Strange, can't see the "reply" buttons on here in IE8 on Windows 7. yes let me try this. Where in the code would I put this? -
Hello. Relative noobie to PHP. Want to find out what variables are being passed to output page, and what the variable name is. Can anyone help please?
-
GREAT! I was being silly with the can't be that easy comment. I racked my brain out trying to figure that one out. His code was so simple! Ok, can I mark the topic as completed, or is this something that you need to do? Thanks gang for all of your help. I can pretty much guarantee I will be back! I love working with PHP. There is just so much to learn. I have had to learn by viewing previous examples and attempting to append their work. Not the best way to learn. I will take any and all tips to learn this stuff.
-
It can't be that easy? :'(
-
Hey that's an outstanding reply. This registration form is a culmination of years of tweaks and different "hands in the pot". It's now dumped in my lap as the original programm(ers) who were volunteers(?) are now long past gone. So I am trying to understand a bit of what they had in here and why, and fixing up others. For example, there is a javascript function call that validates the form that is no longer working, and I have no idea why. Another thing I wanted (and needed) to do with this for is an IF - else statement. Our league has a Spring session and a Summer session. I wanted to create a drop-down menu that gave you those two options. If Spring was selected, it would pull the Spring info as below $lsql = "SELECT * FROM league WHERE (active = 1) AND ([session] = 'Spring') ORDER BY l_id"; but if Summer was selected, it would conversely pull the 'Summer' leagues information. Any thoughts on how I could do this with an "If" statement?
-
if($_POST) { foreach ($_POST as $k=>$v) { $t = stripslashes($v); $t = str_replace("'",'′',$t); $vals[$k] = $t; }
-
Forgive me, but I am new on here. What are the tags you refer to? Is that was you input before that colorized the code?
-
OH GEEZ! It's always the little stuff that gets you in the end. Let me try this... OMG! I spent how many hours working on this? My friend, you are GREAT! Hey mind if I ask you a couple more questions? Much simpler this time? What does this do exactly? if($_POST) { foreach ($_POST as $k=>$v) { $t = stripslashes($v); $t = str_replace("'",'′',$t); $vals[$k] = $t; }
-
Um, forgive me, but what you wrote is exactly what I have in my code. Am I missing something else? Yes I see that dangling comma. Is it not supposed to be there? HELP!
-
Thanks for the prompt reply. First you said:On line 169 you are simply using incorrect syntax. Can you help me here? On line 199 your INSERT statement is causing conflicts with t_id column, being a foreign key. Ok, I have no idea why this is happening. Can you assist at all? Get notepad2 and start using that for your PHP programming? I can do that, but I use Dreamweaver CS3 for my PHP programming.
-
Ok, here are the errors: Warning: mssql_query(): message: Line 1: Incorrect syntax near ')'. (severity 15) in E:\Web Server\baltimorebeach_com\htdocs\registration\regproc2010.php on line 169 Warning: mssql_query(): Query failed in E:\Web Server\baltimorebeach_com\htdocs\registration\regproc2010.php on line 169 Warning: mssql_query(): message: INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK__player__team__3F466844'. The conflict occurred in database 'baltimorebeach', table 'team', column 't_id'. (severity 16) in E:\Web Server\baltimorebeach_com\htdocs\registration\regproc2010.php on line 199 Warning: mssql_query(): Query failed in E:\Web Server\baltimorebeach_com\htdocs\registration\regproc2010.php on line 199 +++++++++++++++++++++++++++++++++++++++++++++++++++ The crazy thing is, all the variables are echoed properly in the receipt page. In the Captain's table and Player's table, the information is inserted into the tables properly. It's the TEAM table that is giving me fits. Anyone have any thoughts?
-
THIS IS WHAT I CALL THE REGISTRATION PROCESSOR PAGE - WHICH INCLUDES OUTPUT TO A RECEIPT PAGE <?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} --> </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; echo "teamname is $vals[teamname]"; echo "shirtcolor is '$vals[shirtcolor]"; }//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; //---------- //Create the team $team_sql = "INSERT INTO team (teamname,shirtcolor,league,captain) VALUES ('$vals[teamname]','$vals[shirtcolor]','$leagueId','$cptId',)"; //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']; $pp_ua = $vals['player'.$i.'_ua']; $pCount ++; $p_sql = "INSERT INTO player (name,email,team,pshirt,p_ua) VALUES ('$pName','$pEmail','$teamId','$ppShirt','$pp_ua')"; $query = mssql_query($p_sql,$conn); $players .= "$pName - $ppShirt $pp_ua<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] Registered for \"Spring\" Leagues 2010!</h3> <p <font face=\"Comic Sans MS\">Thank you for registering with Baltimore Beach. Please be sure to <strong><a href=\"javascript:window.print()\">PRINT</a></strong> this page for your own records. Please remember that <strong>Registration is not considered complete until team fees have been paid</strong>. As captain of the team this responsibility falls to you. We encourage you to send in one </font>check for the entire fee.</p><br>To view all other teams that have registered in your league <a href=\"http://www.baltimorebeach.com/summerleagueinfo.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] $vals[c_ua]<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 $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 Volleyball</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> "; } /* */ ?>