Jump to content

cattledogz

Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cattledogz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well.. I mucked around with it some... still couldn't get it to work.... so I started over with just : [code] <?php $email = $_POST['txtemail']; $formaction = $_POST['action'] ?> <form name="form1" method="post" action="<?echo $_SERVER['PHP_SELF'];?>"> E-Mail Validation<br> <input name="txtemail" type="text" class="textbox" id="txtemail" value="<?php echo $stremail; ?>"> <input name="Submit" type="submit" class="button" value="Submit"> <input name="action" type="hidden" value="submit"></form> <? if (checkEmail($email)) {   echo $email . ' is a valid email address.'; $info = $info ."it works!"; mail("bluecattledogz@yahoo.com","RFID Survey Submission",$info,"From: $email"); } else {   echo $email . '<font color="red"> is not a valid email address.</font>'; } ?> <? function checkEmail($email) {    if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email))    {       return FALSE;    }    list($Username, $Domain) = split("@",$email);    if(@getmxrr($Domain, $MXHost))    {       return TRUE;    }    else    {       if(@fsockopen($Domain, 25, $errno, $errstr, 30))       {          return TRUE;       }       else       {          return FALSE;       }    } } ?> [/code] Now... I got one of my problems fixed... (yay!) BUT... when the page loads, it still comes up says" invalid email"... and it still sends mail... I'm pretty sure that that sending mail part would be something like: [code]<? if (checkEmail($email)) {   echo $email . ' is a valid email address.'; $info = $info ."it works!"; mail("bluecattledogz@yahoo.com","RFID Survey Submission",$info,"From: $email"); } else {   echo $email . '<font color="red"> is not a valid email address.</font>'; } ?>[/code] I put in a hidden <input name="action" type="hidden" value="mailit"> but I'm not sure how to draw that into my funtion to send email apon submitting with a valid email addy. ack! php=pretty hard programing jen
  2. Maybe try something like this (I use this on my "1 or 2 field" search): [code] $searchA=$_POST["field1"]; $searchB=$_POST["field2"]; $action=$_POST["action"]; if ( $action != '' ) { $sql = "SELECT * FROM dbase WHERE searchA LIKE '%$field1%' AND searchB LIKE '%$field2%' ORDER BY field3 ASC LIMIT 0,1000"; $result = mysql_query($sql); // uncomment the echo to see the query //echo $sql; //grab all the content while($r=mysql_fetch_array($result)) { //the format is $variable = $r["dbase"]; $field1=$r["1"]; $field2=$r["2"]; $field3=$r["3"]; //display the row echo "your search results"; } ?>        [/code]
  3. Did you want something like this: [a href=\"http://www.herding.ca/search.php\" target=\"_blank\"]http://www.herding.ca/search.php[/a] It was my first PHP project, (i'm still very new to PHP) but its functional for searching a few different things that you can draw from a dbase. Jen
  4. I need help... I was able to orginally get my form to process multi-checkbox arrays and email it... But now, I need to validate the email address of the person using the form... So.. I started out with a simple form... just to get it working before tacking the huge form that it eventually needs to go on... [code] <?php $email = $_POST['txtemail']; $formaction = $_POST['action'] ?> <? function checkEmail($email) {    if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email))    {       return FALSE;    }    list($Username, $Domain) = split("@",$email);    if(@getmxrr($Domain, $MXHost))    {       return TRUE;    }    else    {       if(@fsockopen($Domain, 25, $errno, $errstr, 30))       {          return TRUE;       }       else       {          return FALSE;       }    } } ?> <form name="form1" method="post" action="<?echo $_SERVER['PHP_SELF'];?>"> <table width="100%"  border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#0033FF" bgcolor="#DEE3EF" > <tr><td width="100%"> <table width="60%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#DEE3EF"> <caption align="top" class="heading"> E-Mail Validation <br> <tr> <td width="46%"><br> <? if(checkEmail($email) == FALSE) {    echo '<div align="right"><font color=red>Invalid Email Address</font></td><td width="54%"><br>'; } //else //{ //   ( $email != '' && $formaction == 'submit'); //} if(checkEmail($email) == TRUE) { ( $email == '' && $formaction == 'submit'); } $info = $info ."it works!"; mail("bluecattledogz@yahoo.com","RFID Survey Submission",$info,"From: $email"); //if ( $email == '' && $formaction == 'submit') { //    echo '<div align="right"><font color=red>Invalid Email Address</font></td><td width="54%"><br>'; //}else{ //    echo '<div align="right">Enter An Email Address </td><td width="54%"><br>'; //} ?> <input name="txtemail" type="text" class="textbox" id="txtemail" value="<?php echo $stremail; ?>">    </tr>    <tr> <td colspan="2"> <div align="center"><br> <input name="Submit" type="submit" class="button" value="Submit"> <input name="action" type="hidden" value="submit">   </div> </td> </tr> </td> <? if ( $email != '' && $formaction == 'submit') { //    echo "Thanks";     echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <script LANGUAGE="JavaScript"> <!-- Begin redirTime = "0"; redirURL = "http://www.rfid-solutions.ca"; function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); } //  End --> </script> </HEAD> <BODY> <BODY onLoad="redirTimer()"> </BODY> </HTML>'; } [/code] I have a couple of problems... 1 - It sends me email when the page loads... 2. - It declares that the email is invalid on first load 3. - Its not validating the email addy... Only if the field is left blank. I can just put in "haha" and it sends mail (attaches the server's domain) What did I di wrong? Jen
  5. Ok.. I have my html form and it does email everything.. my new problem is that I also have the form set up to email the person submitting it.. When it emails the person, despite me having my code like this: [code] $EmailFrom = 'RFID Solutions {jennie@xxx.ca}'; mail("$EMailAddress","RFID - Thank you for taking our Survey", $info, $surinfo,$EmailFrom); [/code] the {} around the email addy are really <> only because it dissappeared in my code here. It emails the "thanks for taking our survey" to the submitter, but it comes from the server (apache@myhost.com)...rather than the email address I defined in my code.... What on earth am I not doing??? I've tried several different things to no avail... jen
  6. Hey... Just wanted to say thanks!! That was exactly what I needed!! Jen
  7. I've been working on this html form.. It is rather long... Needless to say, I want to take all the imput data and email it... I got that part working.. But I am having problems with the "multiple" options arrays.. I can get it to echo on my page, but I can't seem to figure out how to get it in the email... here's my code: [code] <?   $application = $_POST["application"];     $applicationOtherComments = $_POST['applicationOtherComments'];   $RequireSoftware = $_POST['RequireSoftware'];   $range = $_POST["range"];   $tagtype = $HTTP_POST_VARS["tagtype"];   $readerrequirements = $HTTP_POST_VARS["readerrequirements"];   $OtherReaderRequirements = $_POST['OtherReaderRequirements'];   $PurchaseTimeFrame = $_POST['PurchaseTimeFrame'];   $Quantities = $_POST['Quantities'];   $textfield = $_POST['textfield'];   $ContactName = $_POST['ContactName'];   $EMailAddress = $_POST['EMailAddress']; for ($i = 0; $i < sizeof($tagtype); $i++) {     echo $tagtype[$i];     echo "<br />"; } for ($i = 0; $i < sizeof($readerrequirements); $i++) {     echo $readerrequirements[$i];     echo "<br />"; } $when = date("D, F d H:i, Y"); $info = $info . "$when\n\n"; $info= $info  . "Application Type: $application\n"; $info = $info . "Application Comments: $applicationOtherComments\n"; $info = $info . "$RequireSoftware\n"; $info = $info . "Range Requirements: $range\n"; $info = $info . "Tag Types: $tagtype\n"; $info = $info . "Reader Requirements:\n $readerrequirements\n"; $info = $info . "Other Requirements:\n  $OtherReaderRequirements\n"; $info = $info . "Purchase Time Frame: $PurchaseTimeFrame\n"; $info = $info . "Approx. Quantities: $Quantities\n"; $info = $info . "Additional Info:\n  $textfield\n"; $info = $info . "Submitted By: $ContactName\n"; $info = $info . "$EMailAddress\n"; $surveyinfo = $surveyinfo ."$info"; $dinfo = $dinfo ."$info";   mail("emailaddy","RFID Survey Submission: $ContactName",$info,"From: $EMailAddress"); ?> <?   print "<TABLE BORDER=0 BGCOLOR=\"#FFFFFF\" COLUMNS=5 width=600>\n";   print "<TR>";   print "<TH><font face=tahoma size=2 align=left>Thank you $ContactName</TH>\n";   print "</table></td></tr></table>\n"; ?> [/code] Because $tagtype & $readerrequirements have the option of selecting multiple options... I can't get them to appear in my emails as the selections rather than just "Array" as it does now... Help:) Jen
×
×
  • 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.