Jump to content

Error in my code - Need Help


energysuperstore09

Recommended Posts

I am getting an error on line 30

 

$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));

 

Here is the full code

 

<?php
function send_email($from, $to, $subject, $message){
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n"; 

if (mail($to,$subject,$message,$headers) ) {
} else {
}
}

function fmessage($key, $value) {
   return "$key: $value";
}


$messageee = "";
$subject = "Someone has Registered for Distributor Login";
$messageee .= "<html><body>";
$messageee .= "<b>Please inform Daniel.<br></b>";
$messageee .= "<br>";
$messageee .= "<br>Daniel will send an email to user once account is activated.<br>";
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents";
$messageee .= "</body></html>";

$dashedline = str_repeat('-', 70);
$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));
send_email('no-reply@texasfluorescents.com, danielg@fleco.com', $subject, $messageee);

?>

 

Any help would be appreciated.

 

This is the error code that I am getting

 

Fatal error: Only variables can be passed by reference

Link to comment
Share on other sites

array_walk('fmessage', array_keys($_POST), array_values($_POST))

that part is what is causing the error. the first parameter is supposed to be an array variable, not a string. I'm not sure what you trying to accomplish with this, but thats where the error lies

Link to comment
Share on other sites

I told you, you are using the array_walk function completely wrong

array_walk('fmessage', array_keys($_POST), array_values($_POST)

 

array walks parameters go as so

bool array_walk  ( array &$array  , callback $funcname  [, mixed $userdata  ] )

 

you need to pass an array into the array walk function. I don't even know why you are using that function to be completely honest. Would you care to elaborate what you are trying to accomplish with this function?

Link to comment
Share on other sites

LOL I would but I am relying ono some info that someone has gave me advice on.  To be really honest with you I am even more confused.

 

Do you know how i would have the form data emailed to me

 

the code I am using right now is

 

<?php
function send_email($from, $to, $subject, $message){
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n"; 

if (mail($to,$subject,$message,$headers) ) {
} else {
}
}


$messageee = "";
$subject = "Someone has Registered for Distributor Login";
$messageee .= "<html><body>";
$messageee .= "<b>Please inform Daniel.<br></b>";
$messageee .= "<br>";
$messageee .= "<br>Daniel will send an email to user once account is activated.<br>";
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents";
$messageee .= "</body></html>";

send_email("no-reply@texasfluorescents.com", "danielg@fleco.com", 
$subject , 
$messageee);
?>

Link to comment
Share on other sites

Is that the page that the form data submits to? if so just add it in there like

 

//why so many e's at the end of your variable?
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents<br />";
$messageee .= "form data: <br />Username:".$_POST['Username']." etc.";
$messageee .= "</body></html>";

Link to comment
Share on other sites

This is the page that the form submits to

 

<?php

$email = $_POST['email'];
$password = $_POST['pass'];
$password2 = $_POST['pass2'];

@mysql_connect("205.178.146.75","fleco2008","xxxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) != 0) {
die("Another account is already using that email");
}
if ($password != $password2) {
die("The two passwords did not match");
}
$password = md5($password);
mysql_query("INSERT INTO `loginreg` (`email`, `password`, `fname`, `lname`, `repnumber`, `cname`, `phone`) VALUES ('$email', '$password', '$fname', '$lname', '$repnumber', '$cname', '$phone')") or die(mysql_error());
header("Location: /account-pending.php");

?>

Link to comment
Share on other sites

When someone registers it takes them to a page where i tell them that there account is pending until approved.  I use a page called confirm.php to process the form

 

Confirm.php

<?php

$email = $_POST['email'];
$password = $_POST['pass'];
$password2 = $_POST['pass2'];

@mysql_connect("205.178.146.75","fleco2008","xxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) != 0) {
die("Another account is already using that email");
}
if ($password != $password2) {
die("The two passwords did not match");
}
$password = md5($password);
mysql_query("INSERT INTO `loginreg` (`email`, `password`, `fname`, `lname`, `repnumber`, `cname`, `phone`) VALUES ('$email', '$password', '$fname', '$lname', '$repnumber', '$cname', '$phone')") or die(mysql_error());
header("Location: /account-pending.php");

?>

 

This is my register page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registeration for Distributor Area - Go Where the Business Is!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="description" CONTENT="Texas Fluroescents' is a manufacturer of energy efficient linear pendant fluorescent lighting fixtures specifically T5 Industrial Fluorescent Lighting Fixtures, T8 Industrial Fluorescent Lighting Fixtures and T5HO Industrial Fluorescent Lighting Fixtures for industrial lighting, production floor lighting, warehouse lighting.">

<meta NAME="keywords" CONTENT="fluorescent lighting fixtures, T5 Industrial Fluorescent lighting fixtures, T5HO industrial fluorescent lighting fixtures, T8 industrial fluorescent lighting fixtures, T5 warehouse lighting fixtures, T5 warehouse fluorescent lighting fixtures">

<meta NAME="robots" CONTENT="index,follow">


<?php
function send_email($from, $to, $subject, $message){
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n"; 

if (mail($to,$subject,$message,$headers) ) {
} else {
}
}


$messageee = "";
$subject = "Someone has Registered for Distributor Login";
$messageee .= "<html><body>";
$messageee .= "<b>Please inform Daniel.<br></b>";
$messageee .= "<br>";
$messageee .= "<br>Daniel will send an email to user once account is activated.<br>";
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents<br />";
$messageee .= "form data: <br />email:".$_POST['email']." etc.";
$messageee .= "</body></html>";


send_email("no-reply@texasfluorescents.com", "danielg@fleco.com", 
$subject , 
$messageee);
?>

<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>


<div id="container">
<div id="header">
  
  <div id="logo"><a href="index.html"><img src="images/TxFluorescentslogo.jpg" border="0" /></a></div><h1>Texas Fluorescents - Fluorescent Lighting</h1><ul><li><a href="contact_us.html">Contact</a></li><li><a href="comingsoon.html">FAQ   |   </a></li><li><a href="comingsoon.html">Sitemap    |   </a></li><li><a href="comingsoon.html">Support   |   </a></li></ul></div><div id="subhead">your source for quality lighting</div><div id="phone">800-232-7407</div>

<div id="contain">
<div id="nav">
<ul>
<li><a href="index.html">HOME       |</a></li>
<li><a href="companyprofile.html">COMPANY       |</a></li>
<li><a href="products.html">PRODUCTS       |</a></li>
<li><a href="distributorlogin.html">DISTRIBUTOR       |</a></li>
<li><a href="internet_promotions.html">PROMOTIONS       |</a></li>
<li><a href="sales_representatives.html">FIND SALES REP       |</a></li>
<li><a href="contact_us.html">CONTACT US</a></li>
</ul>
</div>
<div id="main"></div>
<div class="beneath">
<div class="specification"><a href="downloadcenter.html"><img src="images/specification-download-center.jpg" border="0" /></a></div>
<div class="retrofitnew"><a href="retrofit.html"><img src="images/retrofit-center.jpg" border="0" /></a></div>
<div class="signup"><a href="internet_promotions.html"><img src="images/signup-now.jpg" border="0" /></a></div>
<div class="quote"><a href="request-quote.html"><img src="images/request-quote.jpg" border="0" /></a></div>
</div>
</div>


<div class="left_pan">

    <ul>
                <span class="style66">  PRODUCTS</span>
	<li><a href="hibay-fluorescents.html">HiBay Fluorescents</a></li>
        <li><a href="linear-pendant-fluorescents.html">Linear Pendant Fluorescents</a></li>
        <li><a href="recessed-fluorescents.html">Recessed Fluorescents</a></li>
        <li><a href="retrofit_refit_kits.html">Retrofit Kits</a></li>
        <li><a href="surfacemounts.html">Surface Fluorescents</a></li>
        <li><a href="wraparounds.html">Wraparounds</a></li>
        <li><a href="fluorescentstrips.html">Fluorescent Strips</a></li>
        <li><a href="closetoceilingCFL.html">Close-to-Ceiling - CFL</a></li>
        <li><a href="wallfixtures.html">Wall Fluorescents</a></li>
        <li><a href="wallpacks.html">HID Wall Packs</a></li>
        <li><a href="floodlights.html">HID Flood Lights</a></li>
        <li><a href="HighBays.html">HID High Bays</a></li>
        <li><a href="comingsoon.html">HID Vandaliers</a></li>
        <li><a href="Essentials.html">Essentials</a></li>
        <li><a href="RecessedDownlights.html">Recessed Downlights</a></li>
        <li><a href="exit_emergency.html">Exit & Emergency Lighting</a></li>
        <li><a href="Ballast_Transformers.html">Ballast & Transformers</a></li>
        <li><a href="NeptunDimmableCFLs.html">Fluorescent Lamps</a></li>
        <li><a href="comingsoon.html">LED Lighting</a></li>
      </ul><ul><span class="style66">  SUPPORT</span> 
            <li><a href="feedback.html">Feedback Form</a></li>
             <li><a href="comingsoon.html">Instruction Sheets</a></li>
             <li><a href="customerservice.html">Customer Service</a></li>
             <li><a href="salesdepartment.html">Sales Department</a></li>
             <li><a href="technicalsupport.html">Technical Support</a></li>
             <li><a href="productinquiry.html">Product Inquiry</a></li>
             <li><a href="comingsoon.html">Returns</a><br />
  </li>
      </ul>
</div>
            
<div class="content">
<h2>Register for Distributor Area</h2>
<p>Please fill out the following form to get your login information to access our distributor area. If you do not know your rep number please contact us at 214-884-1162.</p>
<div class="catagory">
  <div class="green25"><form action="confirm.php" method="post" name="form1" class="dress"><br /><br /><br /><br />
            <label for="repnumber"><span class="algin"><span class="login">Rep Number</span></span></label>
          <input name="repnumber" type="text" class="rep" size="5" />
<br />
            <label for="fname"><span class="algin"><span class="login">First Name</span></span></label>
            <input name="fname" type="text" class="field" />
          <br>
            <label for="lname" class="li1"><span class="algin"><span class="login">Last Name</span></span></label>
            <input name="lname" type="text" class="field" />
          <br>
            <label for="cname"><span class="algin"><span class="login">Company Name</span></span></label>
            <input name="cname" type="text" class="field" />
          <br>
            <label for="phone"><span class="algin"><span class="login">Phone Number</span></span></label>
            <input name="phone" type="text" class="field" />
          <br>
            <label for="email"><span class="algin"><span class="login">Email Address</span></span></label>
          <input name="email" type="text" class="field" />
          <br>
            <span class="formtext">You will use your email address as your username            </span>
            <br><br><label for="password"><span class="algin"><span class="login">Password</span></span></label>
          <input name="pass" type="password" class="field" />
          <br>
            <label for="password" class="login"><span class="algin">Verify Password</span></label>
        <input name="pass2" type="password" class="field" /><br><br />
            <input type="image" src="images/register-button.jpg" class="login-submit" value="Regsiter"/>
            
          <br>
            <br>
  <br />
	    <br />
	    <br />
	    <br />
        <br />
	    <br />
  </form>
   
   
  </div>
  <div class="green30">

  </div>
  <div id="green30">
   
  </div>
</div>
</div>

</div>
<div class="footer"><img src="images/TX-Fluorescent-Footer-Image.gif" />
<p align="center">© Copyright 2009 Texas Fluorescents All Rights Reserved. Developed by <a href="http://www.wired2design.com" target="_blank">WIRED2DESIGN</a> Studios</p></div>
</body>
</html>

 

Any Ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.