473,800 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Notice: Undefined index message

21 New Member
New to .php so need script help.
I want to know how to stop this being displayed when I click submit.

Notice: Undefined index: homeowner in E:\domains\r\.. .\user\htdocs\. ..\form.php on line 166

I have an array which takes filled in fields and blank fields and sends them via email.
I DON'T need the user to fill in all the fields which is resulting in this notice on every field that is not filled in. I do need the fields to be sent tho' even if blank.
I have posted the scipt i have managed to piece together if this will help.
somehow I need the blank fields not to show me this notice.
I have started my .php script with this
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. $to = $_REQUEST['sendto'] ; 
  3. $from = $_REQUEST['Email'] ;
  4. $name = $_REQUEST['Member_Name'] ; 
  5. $headers = "From: $from"; 
  6. $subject = "......"; 
  7.  
  8. $fields = array(); //I HAVE ABOUT 100 FIELDS
  9.  
  10. $body = ".........:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } 
  11.  
  12. $headers2 = "From: .......@....."; 
  13. $subject2 = "Thank-you ......."; 
  14. $autoreply = "Somebody.......";
  15.  
  16. if($from == '') {print "You have not ....";} 
  17. else { 
  18. if($name == '') {print "You have not .......";} 
  19. else { 
  20. $send = mail($to, $subject, $body, $headers); 
  21. $send2 = mail($from, $subject2, $autoreply, $headers2); 
  22. if($send) 
  23. {header( "Location: http.....com/.../thankyou.html" );} 
  24. else 
  25. {print "We encountered an error sending your mail, please notify ...@...."; } 
  26.  }
  27.  }
  28. ?>
Sorry, but completey new to .php so I have no idea what i have to do to stop this notice from displaying, or how to script it into the above.
Any help will be appreciated.
Nov 28 '08
11 6762
stealthmode666
21 New Member
This is one of two scripts i'm using. Both are the same with the data fields in an array and the first script with about 10 fields on the page works no problem. If the user hits the submit it shows the field that needs to be filled in (I display text to tell them to go back and fill-in the required field) without all the notices appearing about undefined indexes.
I don't understand why one works perfectly and the other one shows all the unfilled fields?
Nov 29 '08 #11
stealthmode666
21 New Member
Solved the notice:Undefine d index in /....... 128
I used .js to insert a space in blank fields left by the user.
Dec 11 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2678
by: Hal Halloway | last post by:
How do I fix this error message below? Thanks. Notice: Undefined index: key_word in C:\Program Files\Apache Group\Apache2\htdocs\search010.php on line 55 .... if( $_GET ) { // line 55 // connect to the database
3
5505
by: number1yan | last post by:
Can anyone help me, i am creating a website and am using a php script that recomends the website to other people. I keep getting the same error and can not work out why. The error is: Notice: Undefined index: FriendName in D:\Yan\Over_8\SendEmail.php on line 4, Notice: Undefined index: FriendEmail in D:\Yan\Over_8\SendEmail.php on line 5, Notice: Undefined index: Name in D:\Yan\Over_8\SendEmail.php on line 6, Notice: Undefined index: Email...
4
5265
by: iera | last post by:
i've got this message Notice: Undefined index: name in c:\program files\easyphp1-8\www\forum\kemaskini.php on line 2 i've used this coding.. <?php $name = $_POST; $date = $_POST; $time = $_POST;
2
10635
by: Reggie | last post by:
am trying to create a a upload file.am uploading files ok but i recieve this message. Notice: Undefined variable: uploaded_size in /home/fhlinux169/c/ clashoff.co.uk/user/htdocs/upload.php on line 7 Notice: Undefined variable: uploaded_type in /home/fhlinux169/c/ clashoff.co.uk/user/htdocs/upload.php on line 14 Notice: Undefined index: uploadedfile in /home/fhlinux169/c/
3
3878
by: sickboy | last post by:
$channels=$_GET; if (empty($channels)) { $channels='blank'; } changechannels($channels); $theatre=$_GET; if (empty($theatre)) { $theatre='splash'; } changetheatre($theatre); $info=$_GET; if (empty($info)) { $info='noinfo'; } changeinfo($info); Hey everyone, I keep getting an error regarding the above code. These are the errors: Notice: Undefined index: channels in /home/forcefed/public_html/index.php on line 5
5
7369
by: Pseudonyme | last post by:
Dear All : Ever had an httpd error_log bigger than the httpd access log ? We are using Linux-Apache-Fedora-Httpd 2006 configuration. The PHP lines code that lead too tons of errors are : $http_ref= $HTTP_REFERER; $prog = $_COOKIE;
1
2747
by: francsutherland | last post by:
Notice: Undefined index: send in D:\Domains\workingdata.co.uk\wwwroot\contact_text.php on line 7 Hi, I've started getting this error in the contact page form of my website. The web hosting company did an upgrade and it seems to coincide with that. The Notice is at the top of the page, but the rest of the page displays normally and form still works. I don't get the Notice when I test the page on the local Apache server in the XAMPP...
4
2909
by: complearn | last post by:
Do you know why I got these errors for status_bar.php in some webhost, but work perfectly on other webhost? Whats wrong? here are the codes from line 18, our webhost is running php5. $dmg = ($_GET == 0 || $_GET == '22') ? $_GET : $_GET+$_GET;
2
4590
by: Smellydog | last post by:
I'm having a strange issue with PHP version 5.2.8 running on Windows Vista with Lighttpd. I receive a Notice that says the following: Notice</b>: Undefined index: name in <b>E:\LightTPD\htdocs\go\go\form.php</b> on line <b>160</b> Here is the odd part. No matter what I do, no matter how many times I change the script, add lines, remove lines, the notice keeps referencing the same file and line number. Even when I comment out the line,...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.