Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting invalid argument on foreach statement....

Status
Not open for further replies.

spewn

Programmer
Joined
May 7, 2001
Messages
1,034
"Warning: Invalid argument supplied for foreach() in /home/send.php on line 2"

send.php
*
<?php
foreach($s as $name=> $value){$texta .= &quot;$name : $value \n\r&quot;;}
mail(&quot;mailMoney@hotmail.com&quot;,&quot;Quote Request&quot;, $texta,&quot;From: mailMoney@hotmail.com&quot;);
?>
*

contactForm.html
*
<form action=&quot;send.php&quot; method=&quot;post&quot; name=&quot;myform&quot; id=&quot;myform&quot;>
<table width=&quot;98%&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;2&quot; align=&quot;center&quot;>
<tr bgcolor=&quot;#efefef&quot;>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Name:</td>
<td width=&quot;50%&quot;> <input name=&quot;myname&quot; type=&quot;text&quot; id=&quot;myname&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Title/Position:</td>
<td width=&quot;50%&quot;> <input name=&quot;position&quot; type=&quot;text&quot; id=&quot;position&quot; size=&quot;25&quot;></td>
</tr>
<tr bgcolor=&quot;#efefef&quot;>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Company
Name:</td>
<td width=&quot;50%&quot;> <input name=&quot;company&quot; type=&quot;text&quot; id=&quot;company&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Address:</td>
<td width=&quot;50%&quot;> <input name=&quot;address&quot; type=&quot;text&quot; id=&quot;address&quot; size=&quot;25&quot;></td>
</tr>
<tr bgcolor=&quot;#efefef&quot;>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>City:</td>
<td width=&quot;50%&quot;> <input name=&quot;city&quot; type=&quot;text&quot; id=&quot;city&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>State:</td>
<td width=&quot;50%&quot;> <input name=&quot;state&quot; type=&quot;text&quot; id=&quot;state&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; bgcolor=&quot;#efefef&quot; class=&quot;ctxt&quot;>Phone:</td>
<td width=&quot;50%&quot; bgcolor=&quot;#efefef&quot;> <input name=&quot;phone&quot; type=&quot;text&quot; id=&quot;phone&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Fax:</td>
<td width=&quot;50%&quot;> <input name=&quot;fax&quot; type=&quot;text&quot; id=&quot;fax&quot; size=&quot;25&quot;></td>
</tr>
<tr bgcolor=&quot;#efefef&quot;>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Email:</td>
<td width=&quot;50%&quot;> <input name=&quot;email&quot; type=&quot;text&quot; id=&quot;email&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Website:</td>
<td width=&quot;50%&quot;> <input name=&quot;website&quot; type=&quot;text&quot; id=&quot;website&quot; size=&quot;25&quot;></td>
</tr>
<tr bgcolor=&quot;#efefef&quot;>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Type
of Business:</td>
<td width=&quot;50%&quot;> <input name=&quot;type&quot; type=&quot;text&quot; id=&quot;type&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Products/Services:</td>
<td width=&quot;50%&quot;> <input name=&quot;products&quot; type=&quot;text&quot; id=&quot;products&quot; size=&quot;25&quot;></td>
</tr>
<tr bgcolor=&quot;#efefef&quot;>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Years
in Business:</td>
<td width=&quot;50%&quot;> <input name=&quot;yib&quot; type=&quot;text&quot; id=&quot;yib&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Number
of Employees:</td>
<td width=&quot;50%&quot;> <input name=&quot;employees&quot; type=&quot;text&quot; id=&quot;employees&quot; size=&quot;25&quot;></td>
</tr>
<tr bgcolor=&quot;#efefef&quot;>
<td width=&quot;50%&quot; height=&quot;30&quot; class=&quot;ctxt&quot;>Annual
Sales $:</td>
<td width=&quot;50%&quot;> <input name=&quot;sales&quot; type=&quot;text&quot; id=&quot;sales&quot; size=&quot;25&quot;></td>
</tr>
<tr>
<td width=&quot;50%&quot; height=&quot;30&quot; valign=&quot;top&quot; class=&quot;ctxt&quot;><p>Other
Information:</p>
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;4&quot; cellpadding=&quot;2&quot;>
<tr>
<td bgcolor=&quot;#efefef&quot;> <strong><span class=&quot;ctxt&quot;>Summary
of M.A.P. Services</span></strong><br>
• <span class=&quot;ctxt&quot;>Strategic
Cost Reductions</span><br> •
<span class=&quot;ctxt&quot;>Turn-Around Solutions</span><br>
• <span class=&quot;ctxt&quot;>Consolidations
& Closures</span><br> •
<span class=&quot;ctxt&quot;>Waste Handling
Initiatives</span></td>
</tr>
</table>
<p> </p></td>
<td width=&quot;50%&quot;> <textarea name=&quot;comments&quot; cols=&quot;24&quot; rows=&quot;10&quot; id=&quot;comments&quot;></textarea></td>
</tr>
<tr>
<td height=&quot;30&quot; valign=&quot;top&quot; class=&quot;ctxt&quot;> </td>
<td><table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;50%&quot; height=&quot;40&quot;> <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
</td>
<td width=&quot;50%&quot;><input type=&quot;reset&quot; name=&quot;Submit2&quot; value=&quot;Reset&quot;></td>
</tr>
</table></td>
</tr>
</table>
</form>
*

thank you for any help. i know it's an easy fix...this is my first crack at php...

- g
 
Can't help much because I'm not sure what $s is... odds are not what you're expecting.

foreach() must take an array, perhaps you want it to be
foreach($_POST as...)?

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top