Question

Need help creating individual form fields in this PHP script.

Asked by: webfxonline

I have a PHP script that's running here: http://www.x929.com/xupload/index.php where local bands can upload their mp3's to us via this form.  However, I want to change the single text box field to individual field for the following info so that a message with this info is sent along with the mp3 attachment.

Fields I'd like to add to this form:

Your Band's name

Your Band's Bio & Credits

Contact Phone #

Website URL





Here is the PHP script/form code:

<link rel=stylesheet href="formstyle.css">
<?
include "config.php";
?>
<title>Local X Music Upload</title>
<body bgcolor="#000000">

<div align=center>
<p class=title>
                  <img border="0" src="localxrocks_header.gif" width="518" height="229"></p>
<form action="mail_module.php" method="post" ENCTYPE="multipart/form-data">
<p><table border=0 width="46%" cellspacing=0 cellpadding=8 bgcolor=gray>
<tr><td bgcolor="#F0F0F0" width="36%" align="right"><b>Your band's e-mail
      address</b></td>
<td width="58%" bgcolor="#F0F0F0">
<input class=fi type=text size=46 name=email_from value="<? if($mail_mode==0) echo "anonymous@anonymous-server.com";?>"?>"?>"?>"?></td></tr>
<?
if($mail_mode==0) print("<tr><td bgcolor=\"#F0F0F0\" width=99%><b>TO EMAIL</b></td>
<td width=1% bgcolor=\"#F0F0F0\"><input class=fi type=text size=40 name=email_to_anonymous><br><i>only for testing, please type your real email address</i></td></tr>");
?>
<tr><td bgcolor="#F0F0F0" width="36%" align="right">&nbsp;</td>
<td width="58%" bgcolor="#F0F0F0">
<input class=fi type=text size=46 name=email_subject value="Local X Music Upload"?></td></tr>
</td></tr></table>
<table border=0 width="46%" cellspacing=1 cellpadding=8 bgcolor=#AED0F2>
<tr><td bgcolor=#F0F0F0>
<p align="center"><b><font size="4">Please Include The Following Below:</font></b><div align="center">
      <table border="0" width="27%" id="table1" cellpadding="2">
            <tr>
                  <td>
                  <div align="center">
                        <table border="0" width="53%" id="table2" cellpadding="2">
                              <tr>
                                    <td>
                  <ul>
                        <li>
                        <p align="left"><b><font size="2">Your Band's name</font></b></li>
                        <li>
                        <p align="left"><b><font size="2">Your Band's Bio &amp; Credits</font></b></li>
                        <li>
                        <p align="left"><b><font size="2">Contact Phone # </font></b>
                        </li>
                        <li>
                        <p align="left"><b><font size="2">Website URL</font></b></li>
                  </ul>
                                    </td>
                              </tr>
                        </table>
                        <p align="left"><textarea class=fi name=real_email_message cols=86 rows=14 onclick=createCaret(this); onselect=createCaret(this);>
<? if($mail_mode==0) echo "Test message

With blank lines and <b>HTML</b> tags
<hr>

";?>
</textarea></div>
                  </td>
            </tr>
      </table>
      <p><font color="#FF0000"><b>* MP3 File size must not exceed 6 MB</b></font></div>
</p>
<?
print("
   <p><b>Attach your MP3 file</b> <input class=fi type=\"file\" size=40 name=\"upfile\"><br>
   <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$max_size\">
   <br><u>");
?>

<p align="center">
<input class=fb type="submit" value="Submit" style="font-size: 8pt; font-family: Verdana; font-weight: bold"></td></tr></table>
</form>

&nbsp;</div>

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2007-02-05 at 08:48:54ID22149884
Tags

php

Topic

PHP Scripting Language

Participating Experts
1
Points
500
Comments
29

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Stylesheets
    I am using LINK tag to my stylesheets. All works great in IE 4 but not in Navigator 4. My code is <LINK REL=STYLESHEET TYPE="text/css" HREF="style/mkt.css"> and my stylesheet is BODY {font: 12 pt Arial} H1 {font: 22 pt Times; color: navy; text-a...
  2. Mp3
    I want to put music in my form.Which is the componet that i use for?(To play MP3).
  3. Create a Table With Only Div's and Stylesheets
    Okay, this ones a tricky one, but I'm quite sure it can be done! I need a table that is 100% as wide as the browser. I also can't use tables, thus need to only use stylesheets. The resulting table will be like: <table width="100%" cellpadding=0 cellspacing=0&...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: ebosscherPosted on 2007-02-05 at 10:36:27ID: 18469971

and you want to know how to do that?

 

by: ebosscherPosted on 2007-02-05 at 10:39:54ID: 18470008

first things first, remove your extra php closing tags, you have ?>'s showing up on your site

Secondly, to add more form fields you just add them?  I see you already have two at the top, <input type="text" ... />, and have them replace the <textarea ... />
unless of course you want them to be able to provide free-format information to a question...

Is that clear enough?

 

by: webfxonlinePosted on 2007-02-05 at 11:07:02ID: 18470205

Could you give me an example?

 

by: webfxonlinePosted on 2007-02-05 at 11:16:51ID: 18470287

This was a freeware script that I modified and I've tried tweaking it already w/o suceess.  I'm not a programmer, so your help would be greatly appreciated.

 

by: ebosscherPosted on 2007-02-05 at 11:52:43ID: 18470646

oh boy...

ummm... I would research HTML form tags before trying to go any further if I were you...  A good quick reference that shows how things are done can be found here:

http://www.echoecho.com/htmlforms15.htm

that will give you primer on what you need, and you should be able to see the items in your code there.

 

by: webfxonlinePosted on 2007-02-05 at 12:29:25ID: 18470942

I've added the separate fields but when I receive the e-mail oly the attachment comes thru and not the band's info that get's put in.

http://www.x929.com/xupload/index.php

 

by: ebosscherPosted on 2007-02-05 at 12:39:52ID: 18471053

OK, now that you have the fields you want on the form you'll have to modify the code that receives the information, which from the code you have up there looks like it's mail_module.php (the action in the form tag).  I have no idea what that code looks like, but basically where it's adding items to the mail message you'll have to retrieve the fields you just added to the form using the _$POST['field_name'] and append it to the mail message

you will use the _$POST variable because it contains all of the elements that are posted to the page you are calling (you see your form tag?  the action is "mail_module.php" , which means that is the page this information will be passed to, the type is "post", which means you need to retrieve the information from the _$POST associative array)

do you understand what I mean?

 

by: webfxonlinePosted on 2007-02-05 at 13:56:43ID: 18471769

Sort of......here is the code from my mailmodule.php

<?
include "config.php";
?>
<link rel=stylesheet href="formstyle.css">
<p align=center class=title>Thank You!</p>
<?php  
//----------------------------------------------
function checkfileatt($fname,$fsize){
  global $max_size;
  global $banned_ext;
  $err="No file attached";
  //Checking file type in or out of banned file extensions list
    $pos1=strrchr($fname,".");
    $ftype=str_replace(".","",$pos1);
    $blist=explode("|",$banned_ext);
    for($i=0;$i<sizeof($blist)-1;$i++){
      if($ftype==$blist[$i]) $err="ERROR: Your file extension (<b>*.$ftype</b>) is not be accepted.";
    }
  //Check file size
    if(round($fsize/1024)>$max_size) $err="ERROR: Your file size (<b>" .round($fsize/1024) ."</b> Kb) is too large. We only accept <b>$max_size</b> Kb.";
  //Return the value
  return $err;
}

function formathtml($text){
  $text=stripslashes($text);
  $text=str_replace("\r\n","<BR>",$text);
  $text=str_replace("\n","<BR>",$text);
return $text;
}

function checkemail($email){
  if(!eregi("^[A-za-z0-9\_\.-]+@[A-za-z0-9\_\.-]+.[A-za-z0-9\_-]+.*",$email) || empty($email))
  return FALSE;
  else return TRUE;
}
//----------------------------------------------

    if($mail_mode==0) $email_to=$email_to_anonymous;
    else $email_to=$my_email;
   
    if($version=="demo") {
          $email_from="anonymous@anonymous-server.com";
    }

    $kt=0;
    //Checking valid email address
    if(!checkemail($email_to)) $kt=1;
    if(!checkemail($email_from)) $kt=1;
    if(empty($email_subject)) $kt=2;
   
    if($kt==1) print("<p>ERROR: Email address (From email or To email) is not correct</p>");
    else if($kt==2) print("<p>ERROR: Your email Subject is blank</p>");
   
    if($kt==0){

                //BEGIN //----------------------------------------------
                      $email_message=formathtml($real_email_message);
                      $chked=0;
                      if ($upfile == "none" || $upfile_size==0) $chked=1;
                      if (checkfileatt($upfile_name,$upfile_size)!="No file attached") $chked=1;
                      if($chked==0) {
                            copy($upfile, $upfile_name);
                        $fileatt=$upfile_name;
                        $fileatt_type=$upfile_type;
                        $fileatt_name=$upfile_name;
                        $file = fopen($fileatt,'rb');
                        $data = fread($file,filesize($fileatt));
                        fclose($file);
                      }
                      $headers = "From: ".$email_from;

                      $semi_rand = md5(time());
                      $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

                      $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
                      $email_message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n";

                      $data = chunk_split(base64_encode($data));

                      $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" ."--{$mime_boundary}--\n";
                      $sending_ok = @mail($email_to, $email_subject, $email_message, $headers);

                      if($chked==0) unlink($upfile_name);

                //END mode 3 and 0//----------------------------------------------


                //Print the email result
                if($sending_ok){
                  print("<title>Sending successful to $email_to</title><div align=center><p>Email sending successful</p>");
                }
                else print("<title>Sending failed to $email_to</title><div align=center><p><b>ERROR in mail server</b> Your email could not been sent</p>");

                print("
                    <p><table border=0 width=80% cellspacing=1 bgcolor=#AED0F2><tr><td bgcolor=#F0F0F0>
                     <p><u><b>Sent to email</b></u><br>
                     $email_to
                     <p><u><b>From email</b></u><br>
                     $email_from
                     <p><u><b>Email subject</b></u><br>
                     $email_subject
                    <p><u><b>Message</b></u><p>
                    <table border=0 width=100% cellspacing=1 style=\"border: 1 dotted #AED0F2;\"><tr><td>");
                print(formathtml($real_email_message));
                print("</td></tr></table><p><br></p>
                    <p align=center><a href=$my_url title=\"Come back to my site\">Thank you, back to my site</a>  or  <a href=index.php>Send me another email</a></p>
                    <p><br></p>
                    </td></tr></table>
                   
                    <p><b>Attachment status</b>
                    <p><table border=0 width=80% cellspacing=1 bgcolor=#AED0F2><tr><td bgcolor=#CAE4FF>");
                    if($mail_mode==0 || $mail_mode==1) {
                      if($chked==0) print("<p><b>$upfile_name</b><br>Filesize: " .round($upfile_size/1024) ." Kb | Filetype : $upfile_type");
                      else print("<p>" .checkfileatt($upfile_name,$upfile_size) ."</p>");
                    }
    }
?>
</td></tr></table>
<p><br></p>
<center> &nbsp;</center>

 

by: ebosscherPosted on 2007-02-06 at 07:27:21ID: 18476781

ok, I don't see how it's getting the information out of the variables in that example.  you're probably going to have to look at the included file for that

 

by: webfxonlinePosted on 2007-02-08 at 06:36:02ID: 18493863

Ok, Can you pls help me get this submission form working? I would greatly appreciate the help!

 

by: ebosscherPosted on 2007-02-08 at 12:28:18ID: 18496896

OK, be we'll need to look at the code in config.php - I don't see where mail_module is getting the variables from, and it should be retrieveing them from the $_POST superglobal...

what is in config.php?

Please x out, or delete any code that is not for public consumption (i.e. contains security information, etc)

 

by: webfxonlinePosted on 2007-02-08 at 12:37:05ID: 18496967

OK, here's my config.php:

<?
/*
-------------------------------------------------------
FORM TO EMAIL WITH ATTACHMENT
Version: 1.0
Last update: 13,May,03
-------------------------------------------------------
*/

/*------------------
Mail mode:
 0 for Anonymous HTML email WITH attachment file (For TESTING only: "email_from" and "email_to" fields can be blank)
 1 for HTML email WITH attachment file
------------------*/

      $mail_mode = 1;

//------------------Max file size: Maximum size of attchment file, in (KB)

      $max_size=1000000;

//------------------My email: Your own email address

      $my_email="webmaster@x929.com";


//------------------My URL: Your own website address

      $my_url="http://www.x929.com";

/*------------------
List of banned file extensions:
For security, users can not execute their script
 (uploaded by attachment file) on your server
Note: the charactor "|" MUST be in the end
------------------*/

      $banned_ext="php|phtml|cgi|pl|asp|jsp|c|cfm|shtml|exe|bat|com|";

//------------------Script version

      $version="1.2";
?>

 

by: ebosscherPosted on 2007-02-09 at 09:44:16ID: 18503088

now I'm really confused.  I don't see how it gets the values out of the form, what eversion of PHP are you using?

It looks like it's using a really old-school way of getting the variables, by using the $form_element_name (I had almost forgotten about that)
so, if you add new fields you would need to get the values of those fields and add them to the text before sending the email:

directly after the // BEGIN // ------------------------- comment in mail_module.php you would need to add the field to the email message form:

(I don't know that the ? will work at the end of your HTML field names when translating to a PHP variable, so I removed them for this code example.  I also used all lowercase variable names - you might need uppercase first letters to make this work, OK?)


// BEGIN // ---------------------------------------------
$email_message = "Band Name: " . $band . "\n" . $real_email_message . "\nPhone #: " . $phone . "\nWebsite: " . $website";
$email_message = format_html($email_message);

// continue with the rest of your code unmodified here....

 

by: webfxonlinePosted on 2007-02-09 at 10:00:10ID: 18503217

OK, I made those changes and got this error when I tried submitting an mp3.:

Parse error: syntax error, unexpected '"' in /usr/home/twi/jayhawkbroadcasting/x929/public_html/xupload/mail_module.php on line 58

 

by: ebosscherPosted on 2007-02-09 at 10:05:01ID: 18503252

oh, remove the last double quote of the first line there, right after $website.

did you also cahnge the form so that the ?'s were out of the form names, and that the input's you added were in lowercase?  I don't know if it makes a huge world of difference, but it might

 

by: webfxonlinePosted on 2007-02-09 at 10:10:32ID: 18503298

OK, that time it seemed to take but said


Thank You!

ERROR: Your email Subject is blank

and I have yet to receive the e-mail.

 

by: ebosscherPosted on 2007-02-09 at 10:13:58ID: 18503326

did you enter an email subject?

 

by: webfxonlinePosted on 2007-02-09 at 10:15:39ID: 18503339

I have it set to "Local X Music Upload" within the form

 

by: webfxonlinePosted on 2007-02-09 at 10:18:12ID: 18503355

Here my form now:

<link rel=stylesheet href="css/formstyle.css">
<?
include "config.php";
?>
<title>Local X Music Upload</title>
<body bgcolor="#000000">

<div align=center>
<form action="mail_module.php" method="post" ENCTYPE="multipart/form-data">
<p>
                  <img border="0" src="images/localxrocks_header.gif" width="518" height="229"><table border=0 width="56%" cellspacing=1 cellpadding=8 bgcolor=#AED0F2>
<tr><td bgcolor=#F0F0F0>
<p align="center"><b><font size="4">Please Include The Following Information Below:</font></b><table border="0" width="93%" id="table3" cellpadding="2">
      <tr>
            <td align="right">&nbsp;</td>
            <td width="392">
<input class=fi type=text size=46 name=email_subject value="Local X Music Upload"?></td>
      </tr>
      <tr>
            <td align="right"><b><font size="1">Your band's e-mail
      address</font></b></td>
            <td width="392">
<input class=fi size=46 name=Email_from width="36%" align="right" style="float: none"?></td>
      </tr>
      <tr>
            <td align="right"><b><font size="1">Your Band's name</font></b></td>
            <td width="392">
<input class=fi type=text size=59 name=Band?></td>
      </tr>
      <tr>
            <td align="right"><b><font size="1">Band Bio and Credits</font></b><p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</td>
            <td width="392">
            <textarea class=fi name=Real_email_message cols=57 rows=13 onclick=createCaret(this); onselect=createCaret(this);>
<? if($mail_mode==0) echo "Test message

With blank lines and <b>HTML</b> tags
<hr>

";?>
</textarea></td>
      </tr>
      <tr>
            <td align="right"><b><font size="1">Contact Phone # </font></b>
                        </td>
            <td width="392">
<input class=fi type=text size=59 name=Phone?></td>
      </tr>
      <tr>
            <td align="right"><b><font size="1">Website URL</font></b></td>
            <td width="392">
<input class=fi type=text size=59 name=Website?></td>
      </tr>
</table>
<div align="center">
      <p><font color="#FF0000" size="1"><b>*MP3 File size must not exceed 6 MB</b></font></div>
</p>
<?
print("
   <p><b>Attach your MP3 file</b> <input class=fi type=\"file\" size=40 name=\"upfile\"><br>
   <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$max_size\">
   <br><u>");
?>

<p align="center">
<input class=fb type="submit" value="Submit" style="font-size: 8pt; font-family: Verdana; font-weight: bold"></td></tr></table>
</form>
</div>

 

by: ebosscherPosted on 2007-02-09 at 10:23:56ID: 18503393

change your check email function to use A-Z in all cases, other than A-z to start

other than that I would recommend adding this prior to your if(!checkemail($email_to)) $kt=1; test

echo $email_to . "<br />";
echo $email_from . "<br />";
echo $email_subject . "<br />";
echo $band . "<br />";
echo $real_email_message . "<br />";
echo $website . "<br />";
echo $phone . "<br />";

this will show us what are in the form variables...

 

by: webfxonlinePosted on 2007-02-09 at 10:35:14ID: 18503478

so modify this line to what?

  if(!eregi("^[A-za-z0-9\_\.-]+@[A-za-z0-9\_\.-]+.[A-za-z0-9\_-]+.*",$email) || empty($email))

 

by: webfxonlinePosted on 2007-02-09 at 10:42:54ID: 18503542

this?

  if(!eregi("^[A-ZA-Z0-9\_\.-]+@[A-ZA-Z0-9\_\.-]+.[A-ZA-Z0-9\_-]+.*",$email) || empty($email))

 

by: webfxonlinePosted on 2007-02-09 at 10:50:03ID: 18503592

OK, having made those changes I now get this after submission:

Thank You!

ERROR: Email address (From email or To email) is not correct

It used to work, I just wanted separate form field instead of just 1 "all-inclusive" one.

 

by: ebosscherPosted on 2007-02-09 at 13:00:35ID: 18504505

I think the values of your variables is empty....
I don't know why - but that's what it looks like.

try the echo statemetns I supplied earlier, and if you want this function will validate email address too:

function checkemail( $email )
{
      $valid = false;
      
      if( preg_match('/^([a-z0-9\_\.-]+?)\@([a-z][a-z0-9\_\.-]+)\.([a-z]{2,4})$/i', $email) == 1 )
      {
            $valid = true;
      }

      return $valid;
}

 

by: ebosscherPosted on 2007-02-13 at 11:21:28ID: 18525103

hey webfx, are you still out there?

 

by: webfxonlinePosted on 2007-02-13 at 11:35:20ID: 18525221

Yeah, I'm at home sick today but I still need to get some sort of e-mail attachment script working for the Local X site so bands can upload their MP3's to us but I haven't found a solution yet.  I've almost decided to give up on the previous e-mail attachment script and find something else.  I'm really in a bind "time-frame" wise and need to get something up and running ASAP.

 

by: ebosscherPosted on 2007-02-19 at 14:53:19ID: 18567048

would you try the echo of the variables?  I don't understand why you haven't done that yet?

 

by: webfxonlinePosted on 2007-02-21 at 08:15:17ID: 18579519

Could you pls show me what you mean?

 

by: ebosscherPosted on 2007-02-22 at 17:34:32ID: 18593098

at the top of your script put in this code:

echo $email_to . "<br />";
echo $email_from . "<br />";
echo $email_subject . "<br />";
echo $band . "<br />";
echo $real_email_message . "<br />";
echo $website . "<br />";
echo $phone . "<br />";

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...