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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone tell me what is wrong with my code

Status
Not open for further replies.

jewel464g

Technical User
Jul 18, 2001
198
0
0
US
Whenever I submit this form I get the below errors. And I've tried everything I know to stop them.

Warning: Undefined variable: Style in C:\Inetpub\ on line 3

Warning: Undefined variable: HaveProperty in C:\Inetpub\ on line 3

Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\ in C:\Inetpub\ on line 6





<?php
$subject=&quot;Contact Us Form - Crossroads Web Site&quot;;
$comments=stripslashes(&quot;Square feet of living space: @$Square_Feet \nBudgeted for your new home: @$Budgeted \nStyle preferred: @$Style \nNumber of Bedrooms: @$Bedrooms \nNumber of Bathrooms: @$Bathrooms \nCurrently have a property: @$HaveProperty \nProperty located: @$LOACTED \nYear you want to build your new home: @$Whatyear \nName: @$Name \nAddress: @$Address \nCity, State, Zip: @$City_State_Zip \nPhone: @$Phone \nEmail Address: @$Email \nComments: @$comments&quot;);
mail(&quot;jessica@compunet1.com&quot;,$subject, $comments);
Header(&quot;Location: ?>




If anyone has a clue, I would be much appreciative. Here is a link to the site as well It's just emailing me right now so feel free to try it out.

Thanks,
Jewel When faced with a decision, always ask, 'Which would be the most fun?'
 
You can't use the Header function after anything has been output to your page. Even though you don't print it, I think the mail function outputs a result.
 
In the case of the code presented, the output that causes the &quot;headers already sent&quot; error is the printing of the two error messges. Fix the first two errors, and I believe the third will go away.

It sounds to me like your variables $Style and $HaveProperty are not set to any value. Could it be a capitalization problem? PHP variable names are case-specific.

You're also using the &quot;@&quot; prefix for turning off error reporting with all your variables. Some types of expressions cannot have their reporting turned off. Undefined variables may be one of them. ______________________________________________________________________
Don't say thanks. Just award stars.
______________________________________________________________________
 
I found a solution putting this line at the top of my code fixed everything


error_reporting(0); When faced with a decision, always ask, 'Which would be the most fun?'
 
That does supress error reporting but it doesn't fix the errors you obviously have in your code.

______________________________________________________________________
Don't say thanks. Just award stars.
______________________________________________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top