Jump to content

AJW

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

AJW's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks! I tested the form on the site; even though I turned on error reporting in the PHP file, all I'm getting is a blank page after I hit "submit, and nothing is being sent to my inbox. Any suggestions? <?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid email address. Please re-enter and try again."; } else //if "email" is filled out, send email { //Header information $subject = $name." Registration"; $email = "email@email.com" ; //send email $name = $_POST['Name'] ; $organization = $_POST['Organization'] ; $street = $_POST['Street'] ; $city = $_POST['Street'] ; $state = $_POST['State'] ; $zip = $_POST['Zip'] ; $phone = $_POST['Phone'] ; $fax = $_POST['Fax'] ; $regemail = $_POST['Email'] ; foreach($_POST['project'] as $project) { // $project = whatever is in the value attr e.g. P1,P2,P3 // $_POST[$project . '-attendees'] = e.g. $_POST['P1-attendees'] = what ever you enter into the attendee input echo $project . ' - ' . $_POST[$project . '-attendees'] . '<br />'; } $message= $name." is registering for ".$project." \nOrganization (If Applicable): " .$organization." \nEmail Address: ".$regemail." \nMailing Address: ".$street." \t ".$city." \t ".$state." \t ".$zip." \nPhone Number: ".$phone."\nFax: ".$fax. mail($email, $subject, $message); echo 'Thank you for registering for a BLCE program!'; } } ?>
  2. I'm building a registration form that allows the user to enter some basic information, select the program that they're registering for, then enter the number of attendees for that particular program. The form will make sure that they've entered an email address. (and, later, it will make sure that they've provided a correct answer to a ReCaptcha once I've set one up) If they have, the form results will be emailed to the site owner and a generic "thank you!" message will be generated for the user if the email has been successful. What I'm trying to figure out is how to tell PHP to examine the array of checkboxes that correspond to the programs, and, if it finds that one is checked, to then look at the corresponding "attendees" box and output the number of attendees for that program. I don't really know PHP, so all the code I've got so far is pretty much a hodgepodge of code from various tutorials. I apologize for the mess. <?php function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['regemail'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['regemail']); if ($mailcheck==FALSE) { echo "Invalid email address. Please re-enter and try again."; } else //if "email" is filled out, send email { //Header information $subject = $name." Registration"; $email = "email@email.com" ; //send email $name = $_POST['Name'] ; $organization = $_POST['Organization'] ; $street = $_POST['Street'] ; $city = $_POST['Street'] ; $state = $_POST['State'] ; $zip = $_POST['Zip'] ; $phone = $_POST['Phone'] ; $fax = $_POST['Fax'] ; $regemail = $_POST['Email'] ; $project= implode(",",$_POST['project']); $attendees= array('$p1attend','$p2attend','$p3attend','$p4attend','$YLTattend'); foreach($attendees as $guests) { echo $guests, ' '; } $p1attend= $_POST['P1-attendees']; $p2attend= $_POST['P2-attendees']; $p3attend= $_POST['P3-attendees']; $p4attend= $_POST['P4-attendees']; $YLTattend= $_POST['YLT-attendees']; $message= $name." is registering for ".$project.". There are ".$guests." \nOrganization (If Applicable): " .$organization. "\nEmail Address: ".$regemail." \nMailing Address: ".$street." \t".$city."\t".$state."\t".$zip. "\nPhone Number: ".$phone."\nFax: ".$fax. mail($email, $subject, $message); } } ?> <form action="<txp:site_url/>php/submit.php" method="post"> <table> <tr> <td><label>Name</label></td> <td><input name="Name" type="text" size="25"/></td> </tr> <tr> <td><label>Organization</label></td> <td><input name="Organization" type="text" size="25"/></td> </tr> <tr> <td><label>Street</label></td> <td><input name="Street" type="text" size="25"/></td> </tr> <tr> <td><label>City</label></td> <td><input name="City" type="text" maxlength="4" size=25"/></td> <td><label>State</label></td> <td><input name="State" type="text" /></td> <td><label>Zip</label></td> <td><input name="Zip" type="text" maxlength="5" size="5" /></td> </tr> <tr> <td><label>Phone #</label></td> <td><input name="Phone" type="text" maxlength="13" size="13" /></td> <td><label>Fax #</label></td> <td><input name="Fax" type="text" maxlength="13" size="13" /></td> </tr> <tr> <td><label>Email</label></td> <td><input name="Email" type="text" size="25"/></td> </tr> </table> <table> <thead> <tr> <th><em>Check Below</em></th> <th>Program</th> <th>Time</th> <th>Location</th> <th># of Attendees</th> </tr> </thead> <tbody> <tr> <td><input type="checkbox" NAME="project[]" value="P1" /></td> <td> BASIC COMPONENTS of the GRANT PROPOSAL <br/> <small><strong>March 18, 2010</strong></small> </td> <td>6:30 PM – 8:30 PM</td> <td>Health Partners</td> <td><input name="P1-attendees" type="text" maxlength="2" size="2"></td> </tr> <tr> <td><input type="checkbox" NAME="project[]" value="P1" /></td> <td> WRITING GRANT PROPOSAL GOALS & OBJECTIVES<br/> <small><strong>April 15, 2010</strong></small> </td> <td>6:30 PM – 8:30 PM</td> <td>Health Partners</td> <td><input name="P2-attendees" type="text" maxlength="2" size="2"></td> </tr> <tr> <td><input type="checkbox" NAME="project[]" value="P2" /></td> <td> WRITING BUDGETS & LOCATING FUNDERS<br/> <small><strong>May 20, 2010</strong></small> </td> <td>6:30 PM – 8:30 PM</td> <td>Health Partners</td> <td><input name="P3-attendees" type="text" maxlength="2" size="2"></td> </tr> <tr> <td><input type="checkbox" NAME="project[]" value="P3" /></td> <td> FORMING A 501c3 NON PROFIT ORGANIZATION<br/> <small><strong>May 22, 2010</strong></small> </td> <td>10:00 AM- 1:00 PM</td> <td>Health Partners</td> <td><input name="P4-attendees" type="text" maxlength="2" size="2"></td> </tr> <tr> <td><input type="checkbox" NAME="project[]" value="YLT" /></td> <td> YOUTH LEADERSHIP TRAINING<br/> <small><strong>January 23, 2010 </strong></small> </td> <td>10:00 AM- 1:00 PM</td> <td> </td> <td><input name="YLT-attendees" type="text" maxlength="2" size="2"></td> </tr> </tbody> </table> <br /> <label>Additional Comments</label><br/> <textarea></textarea> <br/> <input type="image" src="<txp:site_url/>images/register-red.png" value="Submit" /> </form>
  3. Let me preface this by saying that I know zilch about PHP, which is why I'm running into what is probably going to be a silly (and simple) error on my part. I'm trying to set up the Textpattern CMS so that sites on subdomains will share the admin-side code with the primary Textpattern installation. There's a new way of doing this that won't work on shared hosting, so I've had to resort to an older method (http://textpattern.net/wiki/index.php?title=How_to_run_multiple_Sites_off_one_install). The part of the instructions I'm having trouble with goes as follows: 1. Now go and edit mydomain/textpattern/index.php: 2. There’s a define() on ± line 20 that says define(“txpath”, dirname(__FILE__)); 3. Change this to say: define(“txpath”, $txpcfg[‘txpath’]); 4. Move this define to ± line 32 after the code that include()‘s config.php Which sounds simple enough. However, the instructions neglect to specify how the added code on line 32 should be formatted, and where exactly after the include code it needs to be (After the comma? Inside the brackets? Outside?). I've tried it in several places that all failed, and I'm getting a slew of Warning: include() errors because the path hasn't been properly defined and the subdomain is still trying to pull the files from its own folder rather than from the main site's folder. I'm stumped, and any help would be greatly appreciated. The relevant section of code is included below. */ if (@ini_get('register_globals')) foreach ( $_REQUEST as $name => $value ) unset($$name); if (!defined('txpath')) { define("txpath", $txpcfg['txpath']); } define("txpinterface", "admin"); $thisversion = '4.2.0'; $txp_using_svn = false; // set false for releases ob_start(NULL, 2048); if (!isset($txpcfg['table_prefix']) && !@include './config.php' ) { ob_end_clean(); header('HTTP/1.1 503 Service Unavailable'); exit('config.php is missing or corrupt. To install Textpattern, visit <a href="./setup/">setup</a>.'); } else ob_end_clean(); I discovered that $txpcfg['txpath'] has been deprecated in newer versions of Textpattern by txpath, although the older method involving $txpcfg['txpath'] is still supposed to work. Also, I'd have no idea how to modify the directions to make txpath work.
  4. Wow. I feel...supremely stupid, at the moment. This whole time I thought I'd been viewing the page through localhost; I'm so used to using the "Preview in Browser" button in Dreamweaver, I didn't even remember that I had to go and type in the manual address. You have my eternal thanks. Excuse me while I go beat my head against a wall for the next ten minutes.
  5. I made the change, but I'm receiving the same error message. I pasted it below, for reference: XML Parsing Error: not well-formed Location: file:///C:/Program%20Files/Apache%20Software%20Foundation/Apache2.2/htdocs/flowertree/index.php Line Number 53, Column 19: if( !isset($_GET['page']) ) ------------------^
  6. I'm trying to do case/include statements for the navigation on my portfolio site, using a basic code I've implemented with the last couple of versions. However, time constraints forced me to use a free template for my site this time around, and I'm running into buckets of problems trying to get it to play nice with this bit of PHP code. <?php echo '<?xml version="1.0"?>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ajwart.com-- the Art of Ashlee J. Williams</title> <!-- version 1.0 - released Nov 18, 2006 --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="Jonas John (www.jonasjohn.de)" /> <meta name="description" content="put a good description in here" /> <meta name="keywords" content="and, insert, some, good, keywords" /> <!-- default stylesheet --> <link rel="stylesheet" type="text/css" href="css/flowertree.css" media="screen, tv, projection" title="Default" /> <!-- print stylesheet (and print preview) --> <link rel="stylesheet" type="text/css" href="css/print.css" media="print" /> <link rel="alternative stylesheet" type="text/css" href="css/print.css" media="screen" title="Print Preview" /> <!-- Navigational metadata (an accessibility feature - use opera to preview) --> <link rel="top" href="index.html" title="Homepage" /> <link rel="up" href="index.html" title="Up" /> <link rel="first" href="index.html" title="First page" /> <link rel="previous" href="index.html" title="Previous page" /> <link rel="next" href="index.html" title="Next page" /> <link rel="last" href="index.html" title="Last page" /> <link rel="toc" href="index.html" title="Table of contents" /> <link rel="index" href="index.html" title="Site map" /> </meta> </head> <body> <div id="logo" class="page"> <a href="index.php" title="Return home">ajwart<span id="logo_black">.com</span></a> </div> <div id="contentbox" class="page"> <div id="padding"> <div id="innerpage"> <div id="content"> <?php if (!isset($_GET['page'])) else $page='home'; $page= $_GET['page'] ; switch($page) { case 'home': include "index.php"; break; case 'gallery': include ("gallery.php"); break; case 'animation': include ("animation.php"); break; case 'contact': include ("contact.php"); break; default: include "content.php"; break; } ?> </div> </div> </div> </div> <!-- i love clean source code --> <div id="menu" class="links"> <a href="content.php?page=home">home</a> / <a href="gallery.php?page=gallery">gallery</a> / <a href="index.html?page=animation">animation</a> / <a href="index.html?page=contact">contact</a> </div> </body> </html> Namely, when I try and open the page it's giving me XML errors about the php not being well formed on Line Number 52, Column 19: if (!isset($_GET['page'])) else $page='home'; $page= $_GET['page'] ; and the arrow is pointing to the p in (!isset($_GET['page'])). I'm very new to PHP; in fact, the only PHP code I've ever used has been this one case/include statement. I've been tearing my hair out for most of the morning trying to figure out what the heck I'm doing wrong, since this has worked all the other times I've used it. I'm wondering if it's because this template uses strict XHTML; usually, I use transitional. Any help with this would be much appreciated. Thanks in advance!
×
×
  • 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.