What does this error messiage means...?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

What does this error messiage means...?

Post by matthiasone »

Warning: Missing argument 1 for eform_db() in /usr/wwws/users/faog/eform_fns.php on line 449

the function referenced has no arguements
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

can you post the function definition for the function in question?
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

Code: Select all

function eform_db()
{
  session_start();
  echo "db";
  $query = "INSERT INTO event_payments values (NULL, '".
	   	   $_SESSION['client']['lname']."', '".$_SESSION['client']['fname']."', '".
		   $_SESSION['client']['address']."', '".$_SESSION['client']['city'].
		   "', '".$_SESSION['client']['state']."', '".$_SESSION['client']['zip'].
		   "', '".$_SESSION['client']['phone']."', '".$_SESSION['client']['email'].
		   "', ".$_SESSION['amount'].", ".$_SESSION['event'].", '".$_SESSION['other']."')";
  echo $query.'<br>';
  $result = query_db($query,'4');
  if($_SESSION['childcare'] == 'Y' and $_SESSION['childcount'] != 0)
  {
    $parent = mysql_insert_id();
    $cquery = "INSERT INTO event_childcare(cname, age, parent) VALUES ";
    for ($i = 0; $i <= $_SESSION['childcount'] - 1; $i++)
    {
      if($i != 0)
	    $cquery .= ', ';
	  $cquery .= "('".$_SESSION['child'][$i]['cname']."', '".$_SESSION['child'][$i]['age']."', '".$parent."')";
    }
    $cresult = query_db($cquery,'4');
  }
  eform_receipt($parent);
}
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

What platform are you running this on?

has it been tested on any other platforms?

if so detail your setup (php version #, OS name and version #, web server name and version #?)
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

what is on line 449... ?


Edit :

These lines

Code: Select all

if($_SESSION['childcare'] == 'Y' and $_SESSION['childcount'] != 0) 
  { 
    $parent = mysql_insert_id(); 
    $cquery = "INSERT INTO event_childcare(cname, age, parent) VALUES "; 
    for ($i = 0; $i <= $_SESSION['childcount'] - 1; $i++) 
    { 
      if($i != 0) 
        $cquery .= ', '; 
      $cquery .= "('".$_SESSION['child'][$i]['cname']."', '".$_SESSION['child'][$i]['age']."', '".$parent."')"; 
    } 
    $cresult = query_db($cquery,'4'); 
  } 
  eform_receipt($parent);
make me think that this is where you are going wrong.

if you see, when the IF statement rings true, $parent is defined. Otherwise, $parent is never defined!

Perhaps eform_recept is expecting a valid definition for $parent?
Last edited by infolock on Tue Sep 13, 2005 12:16 pm, edited 1 time in total.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

I'm assuming the call to eform_db(), which shouldn't be the issue since the error message says "missing argument 1", so unless his function definition has an argument 1 defined we should be able to ignore line 449 for now, that is under the circumstances line 449 is the call to the function.

Edit:

response to your edit:

Code: Select all

<?
functOne();

function functOne() {
	functTwo();
}

function functTwo($test) {
	var_dump ( $test );
}

?>
would give the following error:

Code: Select all

Warning: Missing argument 1 for functtwo() in /home/only/public_html/stfuppl/test/test.php on line 8
and since his warning specifically refers to not the receipt function but the eform_db function it is not a problem with the receipt function, I would think
Last edited by josh on Tue Sep 13, 2005 12:26 pm, edited 2 times in total.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

yeah, that seems very obvious there. But the question is, is he attempting to pass a variable to the function when the function is not built to handle passed values?

thus, why we need to see that line of code....
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

jshpro

Post by matthiasone »

it worked at one point. it is running a unix box at pair.com.

no it as not been tested on any other platforms
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

infolock

Post by matthiasone »

I will test your theory
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

Line 449 is a blank line above the function definition
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

infolock wrote:yeah, that seems very obvious there. But the question is, is he attempting to pass a variable to the function when the function is not built to handle passed values?

thus, why we need to see that line of code....
So you're trying to imply that he did something like:

Code: Select all

<?
functOne('test');

function functOne() {
	
}
?>
But that would not output the warning he is getting, not even a notice, that is specifically valid in PHP for reasons having to do with user-defined functions accepting variable-length argument lists.
Last edited by josh on Tue Sep 13, 2005 12:29 pm, edited 1 time in total.
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

I changed the code to this

Code: Select all

function eform_db()
{
  session_start();
  echo "db";
  $query = "INSERT INTO event_payments values (NULL, '".
	   	   $_SESSION['client']['lname']."', '".$_SESSION['client']['fname']."', '".
		   $_SESSION['client']['address']."', '".$_SESSION['client']['city'].
		   "', '".$_SESSION['client']['state']."', '".$_SESSION['client']['zip'].
		   "', '".$_SESSION['client']['phone']."', '".$_SESSION['client']['email'].
		   "', ".$_SESSION['amount'].", ".$_SESSION['event'].", '".$_SESSION['other']."')";
  echo $query.'<br>';
  $result = query_db($query,'4');
  $parent = mysql_insert_id();
  if($_SESSION['childcare'] == 'Y' and $_SESSION['childcount'] != 0)
  {
    $cquery = "INSERT INTO event_childcare(cname, age, parent) VALUES ";
    for ($i = 0; $i <= $_SESSION['childcount'] - 1; $i++)
    {
      if($i != 0)
	    $cquery .= ', ';
	  $cquery .= "('".$_SESSION['child'][$i]['cname']."', '".$_SESSION['child'][$i]['age']."', '".$parent."')";
    }
    $cresult = query_db($cquery,'4');
  }
  eform_receipt($parent);
}
Still get the same error message.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

I am thinking this is not an issue with your function definition, could you please test your script on another platform, either that or post your entire script and I will look over it.
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

the entire file as your requested

Code: Select all

<?
function eform_pages($area, $page='', $view='', $form_vars='', $mode='', $id='')
{
  if($page == 'info')
    eform_info($id);
  elseif($page == 'isave')
    eform_userinfo($form_vars);
  elseif($page == 'csave')
    eform_childinfo($form_vars);
  elseif($page == 'send')
    gateway_connection($form_vars, 'e');
  elseif($page == 'binfo')
    eform_info($_SESSION['event']);

}
	
function eform_info($id, $message='')
{
  auto_tab();
  session_start();
  $query = "SELECT * FROM event_main WHERE emid ='".$id."'";
  $result = query_db($query, '4'); 
  $event = mysql_fetch_assoc($result);
  if ($event['childcare'] == 'Y')
    $cc = "<tr>\n<td><input type='text' name='cc' size='10' alt='blank' tabindex='9'>".
		  "</td><\n</tr>\n<tr>\n<td><font size='1'>How many children need childcare?</font></td>\n</tr>\n";
  else
    $cc = "<tr>\n<td><input type='hidden' name='cc' value='0'>".
		  "</td><\n</tr>\n";
  $_SESSION['payment'] = $event['payments'];
  $_SESSION['image'] = $event['image'];
  $_SESSION['childcare'] = $event['childcare'];
  $_SESSION['event'] = $event['emid'];
  $_SESSION['codate'] = $event['codate'];
  $_SESSION['cod'] = strtotime($event['codate']);
  $_SESSION['aecost'] = $event['aecost'];
  $_SESSION['pecost'] = $event['pecost'];
  $_SESSION['ccost'] = $event['ccost'];
  $_SESSION['fccost'] = $event['fccost'];

?>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" width="100%">
  <tr>
    <td width="300"><img src="<?=$event['image']?>"></td>
    <td width="300">
	   <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
         <tr bgcolor="#256AA3">
           <td width="10">&nbsp;</td>
		   <td colspan="3"><font size="2" color="#FFFFFF">Billing Information Screen</font></td>
           <td width="10">&nbsp;</td>
	     </tr>  
         <tr>
           <td width="10">&nbsp;</td>
		   <td colspan="3"><font size="2">Please verify that all information 
		    is correct and enter any data missing.  All information is required.</font></td>
           <td width="10">&nbsp;</td>
		</tr>   
        <tr>	
           <td width="10">&nbsp;</td>
           <td colspan="3" align="center"><font size="2" color="red">&nbsp;</td>
           <td width="10">&nbsp;</td>
        </tr>  
        <tr>	
          <td>&nbsp;</td>
          <td>
     	    <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
              <tr>
          <td><form method="post" name="info" action="sinside.php?area=eform&page=isave" 
		       onsubmit="return validateForm( info, 0, 0, 0, 0, 13 );">
	  		      <input type="text" name="fname" size="10" value="<?=$_SESSION['client']['fname']?>" alt="blank" tabindex="1"></td>
	            <td colspan="2"><input type="text" name="lname" size="10" value="<?=$_SESSION['client']['lname']?>" alt="blank" tabindex="2"></td>
    	      </tr>
    	      <tr>
      	        <td><font size="1">First Name</font></td>
       	        <td colspan="2"><font size="1">Last Name</font></td>
  		     </tr>
      	     <tr>
    	        <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
   		     <tr>
		        <td colspan="3"><input type="text" name="address" size="25" value="<?=$_SESSION['client']['address']?>" alt="blank" tabindex="3"></td>
             </tr>
    	     <tr>
       	       <td colspan="3"><font size="1">Address</font></td>
  		     </tr>
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
             <tr>
               <td><input type="text" name="city" size="10" value="<?=$_SESSION['client']['city']?>" alt="blank" tabindex="4"></td>
  	  	       <td><select name="state" tabindex="5">
			     <option><?=$_SESSION['client']['state']?>
				 </option><option>AL</option><option>AS</option><option>AZ</option>
	             <option>AR</option><option>CA</option><option>CO</option><option>CT</option>
	    	     <option>DE</option><option>DC</option><option>FL</option><option>GA</option>
				 <option>HI</option><option>ID</option><option>IL</option><option>IN</option>
				 <option>IA</option><option>KS</option><option>KY</option><option>LA</option>
				 <option>ME</option><option>MD</option><option>MA</option><option>MI</option>
				 <option>MN</option><option>MS</option><option>MT</option><option>NE</option>
				 <option>NV</option><option>NH</option><option>NJ</option><option>NM</option>
				 <option>NY</option><option>NC</option><option>ND</option><option>OH</option>
				 <option>OK</option><option>OR</option><option>PA</option><option>RI</option>
				 <option>SC</option><option>SD</option><option>TN</option><option>TX</option>
				 <option>UT</option><option>VT</option><option>VA</option><option>WA</option>
				 <option>WI</option><option>WY</option></select></td>
  		  	   <td><input type="text" name="zip" size="5" value="<?=$_SESSION['client']['zip']?>" alt="zip" tabindex="6"></td>
    		 </tr>
    	     <tr>
       	      <td><font size="1">City</font></td>
       	      <td><font size="1">State</font></td>
       	      <td><font size="1">Zip Code</font></td>
  		     </tr>
  			</table>
		   </td>
		   <td width="15">&nbsp;</td>
           <td>
     	    <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
             <tr>
			 	  <td colspan="3"><input type="text" name="areacode" value="<?=$_SESSION['client']['areacode']?>" onKeyup="autotab(this, document.info.ext)" maxlength="3" size="3" tabindex="7">
	               <input type="text" name="ext" value="<?=$_SESSION['client']['ext']?>" size="3" onKeyup="autotab(this, document.info.num)" maxlength="3" tabindex="8">
	               <input type="text" name="num" value="<?=$_SESSION['client']['pnum']?>" onKeyup="autotab(this, document.info.email)" size="4" maxlength="4" tabindex="9"></td>
      	      </tr>
    	     <tr>
       	       <td colspan="3"><font size="1">Phone</font></td>
  		     </tr>
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
    		 <tr>
      		<td colspan="3"><input type="text" name="email" value="<?=$_SESSION['client']['email']?>" alt="email" tabindex="8"></td>
   			  </tr>
    	     <tr>
       	       <td colspan="3"><font size="1">Email Address</font></td>
  		     </tr>
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
			 <?=$event['extrafields']?>
			 <?=$cc?>
  			</table>
		  </td>
         <td>&nbsp;</td>
    	</tr>
  		<tr>
          <td align="right" colspan="2">
		  <td align="right"><input type="reset" value="Clear"><input type="submit" value="Next"></form></td>
       	</tr>
     </table>
   </td>
  </tr>
</table>
<?
}
function eform_childcare()
{
  session_start();
  for ($i = 0; $i <= $_SESSION['childcount'] - 1; $i++)
  {
     $cform .= "<tr>\n<td><input type='text' name='cn".$i."' size='20'></td>\n<td width='10'>&nbsp;</td>\n".
			   "<td><input type='text' name='ca".$i."' size='7'></td>\n</tr>\n";
  }		   
  

?>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" width="100%">
  <tr>
    <td width="300"><img src="<?=$_SESSION['image']?>"></td>
    <td width="300">
	   <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
         <tr bgcolor="#256AA3">
           <td width="10">&nbsp;</td>
		   <td colspan="3"><font size="2" color="#FFFFFF">Childcare Information Screen</font></td>
           <td width="10">&nbsp;</td>
	     </tr>  
         <tr>
           <td width="10">&nbsp;</td>
		   <td colspan="3"><font size="2">Please verify that all information 
		    is correct and enter any data missing.  All information is required.</td>
           <td width="10">&nbsp;</td>
		</tr>   
        <tr>	
           <td width="10">&nbsp;</td>
           <td colspan="3" align="center"><font size="2" color="red"><?=$message?></td>
           <td width="10">&nbsp;</td>
        </tr>  
        <tr>	
          <td>&nbsp;</td>
          <td>
     	    <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
              <tr>
			    <td><form method="post" name="info" action="sinside.php?area=eform&page=csave" 
		            onsubmit="return validateForm( login, 0, 0, 0, 0, 13 );"><font size="2">Child's Name</font></td>
			    <td width='10'>&nbsp;</td>
	            <td><font size="2">Child's Age</font></td>
    	      </tr>
			  <?=$cform?>
  		      <tr>
                <td align="right" colspan="2">
		        <td align="right"><input type="reset" value="Clear"><input type="submit" value="Next"></form></td>
        	  </tr>
			</table>
		  </td>
		</tr>
	  </table>	  	  
   </td>
  </tr>
</table>
<?
}

function eform_ccinfo($message='')
{
  auto_tab();
  session_start();
  $cdate = strtotime('Now');
  
  if ( $cdate <= $_SESSION['cod'])
  	 $ramount = $_SESSION['aecost'];
  else
  	 $ramount = $_SESSION['pecost'];
  if ($_SESSION['childcare'] == 'Y')
  {
    if ($_SESSION['childcount'] <= 2)
  	 $camount = $_SESSION['ccost'] * $_SESSION['childcount'];
    else
  	 $camount = $_SESSION['fccost'];
  }
 $amount = $ramount + $camount;
 $_SESSION['ramount'] = $ramount;
 $_SESSION['camount'] = $camount;
 $_SESSION['amount'] = $amount;
 $_SESSION['description'] = $_SESSION['ename'].' - Registration = '.$ramount.
 						    '  Childcare = '.$camount;
?>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" width="100%">
  <tr>
    <td width="300"><img src="<?=$_SESSION['image']?>"></td>
     <td width="300">
	   <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
         <tr bgcolor="#256AA3">
           <td width="10">&nbsp;</td>
		   <td colspan="3"><font size="2" color="#FFFFFF">Payment Screen</font></td>
           <td width="10">&nbsp;</td>
	     </tr>  
         <tr>
           <td width="10">&nbsp;</td>
		   <td colspan="3"><font size="2">Please verify that all information 
		    is correct and enter any data missing.  All information is required.</td>
           <td width="10">&nbsp;</td>
		</tr>   
        <tr>	
           <td width="10">&nbsp;</td>
           <td colspan="3" align="center"><font size="2" color="red"><?=$message?></td>
           <td width="10">&nbsp;</td>
        </tr>  
        <tr>	
          <td>&nbsp;</td>
          <td>
     	    <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
              <tr>
                <td><input type="text" name="fname" size="10" value="<?=$_SESSION['client']['fname']?>" alt="blank" tabindex="1"></td>
	            <td colspan="2"><input type="text" name="lname" size="10" value="<?=$_SESSION['client']['lname']?>" alt="blank" tabindex="2"></td>
    	      </tr>
    	      <tr>
      	        <td><font size="1">First Name</font></td>
       	        <td colspan="2"><font size="1">Last Name</font></td>
  		     </tr>
      	     <tr>
    	        <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
   		     <tr>
		        <td colspan="3"><input type="text" name="address" size="25" value="<?=$_SESSION['client']['address']?>" alt="blank" tabindex="3"></td>
             </tr>
    	     <tr>
       	       <td colspan="3"><font size="1">Address</font></td>
  		     </tr>
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
             <tr>
               <td><input type="text" name="city" size="10" value="<?=$_SESSION['client']['city']?>" alt="blank" tabindex="4"></td>
  	  	       <td><select name="state" tabindex="5">
			     <option><?=$_SESSION['client']['state']?>
				 </option><option>AL</option><option>AS</option><option>AZ</option>
	             <option>AR</option><option>CA</option><option>CO</option><option>CT</option>
	    	     <option>DE</option><option>DC</option><option>FL</option><option>GA</option>
				 <option>HI</option><option>ID</option><option>IL</option><option>IN</option>
				 <option>IA</option><option>KS</option><option>KY</option><option>LA</option>
				 <option>ME</option><option>MD</option><option>MA</option><option>MI</option>
				 <option>MN</option><option>MS</option><option>MT</option><option>NE</option>
				 <option>NV</option><option>NH</option><option>NJ</option><option>NM</option>
				 <option>NY</option><option>NC</option><option>ND</option><option>OH</option>
				 <option>OK</option><option>OR</option><option>PA</option><option>RI</option>
				 <option>SC</option><option>SD</option><option>TN</option><option>TX</option>
				 <option>UT</option><option>VT</option><option>VA</option><option>WA</option>
				 <option>WI</option><option>WY</option></select></td>
  		  	   <td><input type="text" name="zip" size="5" value="<?=$_SESSION['client']['zip']?>" alt="zip" tabindex="6"></td>
    		 </tr>
    	     <tr>
       	      <td><font size="1">City</font></td>
       	      <td><font size="1">State</font></td>
       	      <td><font size="1">Zip Code</font></td>
  		     </tr>
  			</table>
		   </td>
		   <td width="15">&nbsp;</td>
           <td>
     	    <table border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D8E8">
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
             <tr>
	           <td colspan="3"><input type="text" name="areacode" value="<?=$_SESSION['client']['areacode']?>" onKeyup="autotab(this, document.newuser.ext)" maxlength="3" size="3" tabindex="7">
	               <input type="text" name="ext" value="<?=$_SESSION['client']['ext']?>" size="3" onKeyup="autotab(this, document.newuser.num)" maxlength="3" tabindex="8">
	               <input type="text" name="num" value="<?=$_SESSION['client']['pnum']?>" onKeyup="autotab(this, document.newuser.email)" size="4" maxlength="4" tabindex="9"></td>
      	      </tr>
    	     <tr>
       	       <td colspan="3"><font size="1">Phone</font></td>
  		     </tr>
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
    		 <tr>
      		<td colspan="3"><input type="text" name="email" value="<?=$_SESSION['client']['email']?>" alt="email" tabindex="8"></td>
   			  </tr>
    	     <tr>
       	       <td colspan="3"><font size="1">Email Address</font></td>
  		     </tr>
      	     <tr>
    	       <td colspan="3"><font size="1">&nbsp;</font></td>
    	     </tr>
  			</table>
		  </td>
         <td>&nbsp;</td>
    	</tr>
      	<tr bgcolor="#256AA3">
    	  <td colspan="5" align="right"><font size="1"><img src="images/visa.gif" height="17">
		    <img src="images/mcard.gif" height="17"><img src="images/discovery.gif" height="17"><img src="images/amexp.gif" height="17"></font></td>
    	</tr>
		<tr>  
          <td>&nbsp;</td>
		  <td colspan="3">
     	    <table border="0" cellpadding="0" cellspacing="0"  bgcolor="#C8D8E8">
      	      <tr>
    	        <td><font size="1">&nbsp;</font></td>
    	     </tr>
	          <tr>
   	     	    <td><font size="2" color="#000000">
				    <form method="post" name="login" action="sinside.php?area=eform&page=send" 
		              onsubmit="return validateForm( login, 0, 0, 0, 0, 13 );">
			   <input type="text" name="cnum" size="30" alt="blank" emsg="Please enter a VALID Credit Card Num"></td>
              </tr>
    	      <tr>
       	        <td><font size="1">Credit Card Num</font></td>
  		      </tr>
      	     <tr>
    	       <td><font size="1">&nbsp;</font></td>
    	     </tr>
		     </table>
		  </td>	 
          <td>&nbsp;</td>
		</tr>
		<tr>  
          <td>&nbsp;</td>
		  <td valign="top">
     	    <table border="0" cellpadding="0" cellspacing="0"  bgcolor="#C8D8E8">
       		 <tr>
  	     	   <td><font size="2" color="#000000"><input type="text" name="edate" size="10" alt="blank" emsg="Please enter a VALID Expiration Date"></td>
             </tr>
    	     <tr>
       	       <td><font size="1">Credit Card Expiration Date (mmyy)</font></td>
  		     </tr>
      	     <tr>
    	       <td><font size="1">&nbsp;</font></td>
    	     </tr>
			</table> 
       	   </td>
		   <td width="15">&nbsp;</td>
		   <td>
     	    <table border="0" cellpadding="0" cellspacing="0"  bgcolor="#C8D8E8">
			 <tr>
  	     	   <td><font size="2" color="#000000">$
			     <input type="text" name="amount" size="10" value="<?=sprintf('%01.2f', $amount)?>"></td>
       		 </tr>
    	     <tr>
       	       <td><font size="1">Amount</font></td>
  		     </tr>
      	     <tr>
    	       <td><font size="1">&nbsp;</font></td>
    	     </tr>
       		 <tr>
        	   <td align="right">
			      <input type="reset" value="Clear"><input type="submit" value="Next"></form></td>
     	   </table>
          </td>
          <td>&nbsp;</td>
        </tr>  
     </table>
   </td>
  </tr>
</table>
<?
}

function eform_userinfo($form_vars)
{
  session_start();
  $_SESSION['client']['fname'] = ucfirst(strtolower($form_vars['fname']));
  $_SESSION['client']['lname'] = ucfirst(strtolower($form_vars['lname']));
  $_SESSION['client']['address'] = ucfirst(strtolower($form_vars['address']));
  $_SESSION['client']['city'] = ucfirst(strtolower($form_vars['city']));
  $_SESSION['client']['state'] = strtoupper($form_vars['state']);
  $_SESSION['client']['zip'] = $form_vars['zip'];
  $_SESSION['client']['phone'] = $form_vars['areacode'].$form_vars['ext'].$form_vars['num'];
  $_SESSION['client']['areacode'] = $form_vars['areacode'];
  $_SESSION['client']['ext'] = $form_vars['ext'];
  $_SESSION['client']['pnum'] = $form_vars['num'];
  $_SESSION['client']['email'] = $form_vars['email'];
  $_SESSION['childcount'] = $form_vars['cc'];
  $_SESSION['other'] = $form_vars['other'];
  if($_SESSION['childcare'] == 'Y' and $form_vars['cc'] != 0)
    eform_childcare();
  elseif($_SESSION['payment'] == 'Y')	
    eform_ccinfo();
  else
    eform_db();	
}

function eform_childinfo($form_vars)
{
  session_start();
  
  for ($i = 0; $i <= $_SESSION['childcount'] - 1; $i++)
  {
     $ntemp = 'cn'.$i;
     $atemp = 'ca'.$i;
    $_SESSION['child'][$i]['cname'] = ucfirst(strtolower($form_vars[$ntemp]));
    $_SESSION['child'][$i]['age'] = ucfirst(strtolower($form_vars[$atemp]));
  }		   
  if($_SESSION['payment'] == 'Y')	
    eform_ccinfo();
  else
    eform_db();	
}


function eform_db()
{
  session_start();
  echo "db";
  $query = "INSERT INTO event_payments values (NULL, '".
	   	   $_SESSION['client']['lname']."', '".$_SESSION['client']['fname']."', '".
		   $_SESSION['client']['address']."', '".$_SESSION['client']['city'].
		   "', '".$_SESSION['client']['state']."', '".$_SESSION['client']['zip'].
		   "', '".$_SESSION['client']['phone']."', '".$_SESSION['client']['email'].
		   "', ".$_SESSION['amount'].", ".$_SESSION['event'].", '".$_SESSION['other']."')";
  echo $query.'<br>';
  $result = query_db($query,'4');
  $parent = mysql_insert_id();
  if($_SESSION['childcare'] == 'Y' and $_SESSION['childcount'] != 0)
  {
    $cquery = "INSERT INTO event_childcare(cname, age, parent) VALUES ";
    for ($i = 0; $i <= $_SESSION['childcount'] - 1; $i++)
    {
      if($i != 0)
	    $cquery .= ', ';
	  $cquery .= "('".$_SESSION['child'][$i]['cname']."', '".$_SESSION['child'][$i]['age']."', '".$parent."')";
    }
    $cresult = query_db($cquery,'4');
  }
  eform_receipt($parent);
}

function eform_receipt($pid)
{
  session_start();
  $emid = $_SESSION['event'];
  $cnum = $_SESSION['childcount'];
  session_unset();
  session_destroy();

  $equery = "SELECT * FROM event_main WHERE emid = '".$emid."'";
  $eresult = query_db($equery, '4');
  $event = mysql_fetch_assoc($eresult);
  $pquery = "SELECT * FROM event_payments WHERE pid = '".$pid."' AND event = '".$emid."'";
  $presult = query_db($pquery, '4');
  $client = mysql_fetch_assoc($presult);
  if($cnum != 0)
  {
    $ccquery = "SELECT * FROM event_childcare WHERE parent = '".$pid."'";
    $ccresult = query_db($ccquery, '4');
    $num_rows = mysql_num_rows($ccresult);
    for ($k = 0; $k <= $num_rows - 1; $k++)
    {
      $detail = mysql_fetch_assoc($ccresult);
	  if(($i % 2) ==  1)
	    $bg = " bgcolor='#EDEEE6'";
	  else
	    $bg = '';
      $cnlist = "<td align='center'><font size='2'>".$detail['cname']."</font></td>\n";
      $calist = "<td align='center'><font size='2'>".$detail['age']."</font></td>\n";
	  $citems .= "<tr".$bg.">".$cnlist."<td width='10'>&nbsp;</td>\n".$calist."</tr>\n";
    }
  }
  else
 	  $citems .= "<tr><td colspan='3' align='center'>No Childcare needed</td>\n</tr>\n";
   		
  $cdate = strtotime('Now');
  
  if ( $cdate <= strtotime($event['codate']))
  	 $ramount = $event['aecost'];
  else
  	 $ramount = $event['pecost'];
  if ($event['childcare'] == 'Y')
  {
    if ($num_rows <= 2)
  	 $camount = $event['ccost'] * $num_rows;
    else
  	 $camount = $event['fccost'];
  }
 $amount = $ramount + $camount;
 $framount = sprintf("$%01.2f", $ramount);
 $fcamount = sprintf("$%01.2f", $camount);
 $famount = sprintf("$%01.2f", $amount);
?>
  <table border="0" cellpadding="0" cellspacing="0" bgcolor="FFFFFF" width="100%">
    <tr>
      <td><font size="2">Thank you for registering for this event.  Please retain 
	     this page for your records.  You should receive an email receipt too.</font></td>
    </tr>
	<tr>  
	  <td valign="top">  
		<table border="0" cellpadding="0" cellspacing="0">
		  <tr>	
		    <td colspan="2"><font size="2"><b>Contact Info</b></font></td>
		  </tr>
		  <tr>	
		    <td width="10">&nbsp;</td>
			<td><font size="2"><?=$client['fname']." ".$client['lname']?></font></td>
		  </tr>
		  <tr>
		    <td width="10">&nbsp;</td>
		    <td><font size="2"><b>Billing Address:</b><br><?=$client['address']?></font></td>
		  </tr>
		  <tr>
		    <td width="10">&nbsp;</td>
		    <td><font size="2">
			    <?=$client['city'].",".$client['state']." ".$client['zip']?></font></td>
		  </tr>
		  <tr>
		    <td width="10">&nbsp;</td>
		    <td><font size="2"><?=$client['phone']?></font></td>
		  </tr>
		  <tr>
		    <td width="10">&nbsp;</td>
		    <td><font size="2"><?=$client['email']?></font></td>
		  </tr>
		  <tr>
		    <td colspan="2">&nbsp;</td>
		  </tr>
		</table>
	  </td>  
    </tr>
	<tr>
	  <td valign="top">  
		<table border="0" cellpadding="0" cellspacing="0">
		  <tr>	
		    <td colspan="2"><font size="2"><b>Payment Info</b></font></td>
		  </tr>
		  <tr>	
		    <td width="10">&nbsp;</td>
		    <td><font size="2">Registration Fees: <?=$framount?></font></td>
		  </tr>
		  <tr>	
		    <td width="10">&nbsp;</td>
		    <td><font size="2">Childcare Fees: <?=$fcamount?></font></td>
		  </tr>
		  <tr>	
		    <td width="10">&nbsp;</td>
		    <td><font size="2">Total Paid: <?=$famount?></font></td>
		  </tr>
		  <tr>
		    <td colspan="2">&nbsp;</td>
		  </tr>
		</table>
	  </td>
	</tr>    
	<tr>
	  <td valign="top">  
		<table border="0" cellpadding="0" cellspacing="0" width="50%">
		  <tr>	
		    <td align="center"><font size="2"><b>Child's Name</b></font></td>
		    <td width="10">&nbsp;</td>
		    <td align="center"><font size="2"><b>Age</b></font></td>
		  </tr>
          <?=$citems?>
		  <tr>
		    <td colspan="3">&nbsp;</td>
		  </tr>
		</table>
	  </td>
	</tr>
  </table>	    
	
<?
}
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

matthiasone,

after testing this script and doing some example calls to your user-defined functions I was unable to produce the error message you posted. However I did notice a missing definition for query_db(), which now leads me to believe the code you posted above is being included from an external script?

You also said that this exact code used to work, which further suggests it is an issue with your configuration. What kind of hosting are you getting from pair.com ? If you have a dedi, please try re-building PHP and using the default php.ini settings, if it is shared hosting you are going to have to figure out exactly what is causing the error before you can take further action (emailing pair networks requesting they change the configuration, or using ini_set() to resolve the issue itself)

Keep in mind we have not proven this is a configuration issue, yet... so the only thing you can do for now, is look at php.ini (if you're using a shared host), if you're using a dedicated server try replacing php.ini with the defaults... start looking at phpinfo(), and if possible test your code on other platforms.

Another thing you could try is doing a backtrace in all of your functions, I doubt this will find us any solutions though.
Post Reply