473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Notice: Undefined Index on remote server but not in local testing.

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 installation.

I've checked that the variable is spelled the same throughout the code. I tried using 'submit' as the variable in the IF statement instead of 'send' and got the same Notice.

I'm still new to PHP. I don't understand which element of the code is causing the error, so I'm afraid I've pasted the lot in. It's an IF statement which asks if the send variable is there or not. If it is there, then the form's already been filled in and it displays a "thanks for your question" message, otherwise, if it's not there, it displays the form.

Thanks,

Franc.

[code]
<?php
// if the "submit" variable does not exit, the form has not been submitted, display initial page.

if (!$_POST['send'])
{
?>

<style type="text/css">
<!--
.style1 {color: #000000}
-->
</style>
<table width="620" align="center" cellpadding="0" cellspacing="0">

<tr>
<td width="620">
<h1 class="heading" align="left">We look forward to hearing from you
<img src="images/yellow dot.gif" height="1" width="330"></h1>
</td>
</tr>
<tr>
<td width="620" class="text">
You can contact us directly by filling out the contact form below.
Simply fill out your name, email address and your query, then click on submit.
We promise to get back to you within 24 working hours.
Alternatively, our contact details are listed at the foot of the page.
</td>
</tr>
<tr><td colspan="1" height="10"></td></tr>
<tr>
<td width="620">
<form class="products_table"action="contact.php" method="post">
<p class="body_text">Your name: <br><input type="text" name="user_name"></p>
<p class="body_text">Your email address: <br><input type="text" name="user_email"></p>
<p class="body_text">Your enquiry: <br><textarea name="user_enquiry" cols="60" rows="10"></textarea></p>
<p class="body_text"><input type="submit" value="submit" name="send"></p>
</form>
</td>
</tr>
<tr>
<td class="text" height="20">
</td>
</tr>
<tr><td height="10"><span class="text"><strong>If you would prefer </strong>, please contact us by one of the methods outlined below. </span></td>
</tr>
<tr><td>
<table width="620" cellpadding="0" cellspacing="0">
<tr><td height="20" colspan="2"></td></tr>
<tr>
<td width="70" colspan="1" valign="top" class="text style1">Post: </td>
<td class="text" colspan="1" width="548"><div align="left">
Working Data. <br>
24 Villiers Street, <br>
Leamington Spa, <br>
Warwickshire, <br>
United Kingdom. <br>
CV32 5YH.</div></td>
</tr>
<tr><td height="10" colspan="2"></td></tr>
<tr>
<td width="70" colspan="1" class="text style1">Tel/Fax: </td>
<td class="text" colspan="1" width="548">+44 (0) 1926 335 772</td>
</tr>
<tr><td height="10" colspan="2"></td></tr>
<tr>
<td width="70" colspan="1" class="text style1">Email: </td>
<td class="text" colspan="1" width="548"><a href="mailto:info@workingdata.co.uk">info@workingd ata.co.uk</a></td>
</tr>
<tr><td height="10" colspan="2"></td></tr>
</table>
</td></tr>

</table>

<?php
}
else
{
// if the submit variable exists, the form has been submitted.
// look for and process form data, display result.

$query_name=trim($_POST['user_name']);
$query_address=trim($_POST['user_email']);
$query_text=trim($_POST['user_enquiry']);

//echo "<p>Dear $query_name. Many thanks for your enquiry (detailed below). We will reply to $query_address with all haste</p>";
//echo "<p>$query_text</p>";
mail ("info@workingdata.co.uk","Contact Form Question",$query_text,"From: $query_address");
/*mail (query_address,"Working Data Enquiry Confirmation","Dear $query_name, This is an automated confirmation for the
enquiry you submitted. We will reply as soon as possible.","From: info@workingdata.co.uk");
*/
?>

<table width="620" align="center" cellpadding="0" cellspacing="0">
<tr><td>&nbsp;</td></tr>
<tr>
<td width="620">
<h1 class="heading" align="left"><u>Thank you very much indeed for your enquiry.</u></h1>
</td>
</tr>
<tr>
<td width="620">
<?php
echo "<p>Dear $query_name. Many thanks for your enquiry (detailed below). We will reply to $query_address within 24
working hours.</p><br>";
?>

</td>
</tr>
<tr><td><hr></td></tr>
<tr>
<td width="620">
<?php
echo "<p>$query_text</p>";
?>
</td>
</tr>
</table>
<?php
}
?>
[code]
Feb 4 '08 #1
1 2721
eragon
431 256MB
Welcome to TSDN. May i suggest changing your line

[PHP]if(!$_POST['send'])[/PHP]

to

[PHP]if(empty($_POST['send']))[/PHP]

The empty command is a more effective command that determines if a string is missing or does not exist.
Feb 4 '08 #2

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

Similar topics

11
by: juglesh | last post by:
at one centraldomain.com, I have central.php, which consists of this: <?php function square($num) { return $num * $num; } ?> at outerdomain.com, I have test.php, which consists of this:...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
1
by: enrique | last post by:
Hello everyone, I'm looking for a "directory path" solution that will allows me to test my app locally and then test on remote web server without having to update my web.config file each time I...
3
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:...
3
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...
5
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 : ...
7
by: RN1 | last post by:
Is it possible to connect to my local SQL Server 2005 database from a remote web server? If yes, what ConnectionString do I use? Thanks, Ron
4
hemantbasva
by: hemantbasva | last post by:
We have designed an aspx page having five ajax tab in it. the data of first four are designed on page whereas for the fifth tab it renders a user control named MYDOMAIN. in the tab container's even...
2
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.