- This topic is empty.
-
AuthorPosts
-
September 5, 2013 at 5:09 pm #149211AlenParticipant
Before this turns into shouting match between us how about we actually focus on answering the question. We haven’t seen the actual code, so am not sure that suppressing notices will fix the problem. Just looking at the code quickly, there is
$PHP_SELF
as form action… now am not sure if this is defined previously, but something likeecho $_SERVER['PHP_SELF'];
should be there instead. In addition, there are bunch of lines with missing semicolons. (Again this could be because forum is stripping code).September 5, 2013 at 6:35 pm #149215__ParticipantI agree that we don’t need a shouting match, but, to be clear:
…
E_NOTICE
is most definitely an error.… If you don’t know why the error is occurring, then it should be considered serious.
Undefined variables are not insignificant. If a script is trying to use a variable for some purpose, and that variable doesn’t exist, then something is going to go wrong. Ignoring the error message will not “solve” the problem – in fact, it will make the problem worse by making it more difficult to discover the problem in the first place.
These particular errors may be minor. That doesn’t mean they should be ignored – it means they’re easy to fix. Take the message you pointed out:
Notice: Undefined index: submit . . .
Just a shot in the dark, but I bet there’s something like
if( $_POST['submit'] ){ /* process form submission */ }
This is trivial to fix.
It should have been written like this in the first place:if( isset( $_POST['submit'] ) ){ /* process form submission */ }
PHP’s “default” error settings are a compromise between knowing about errors and placating those who complain about knowing about errors. “Default” is not the same as “Recommended.” There is only one error setting I recommend, under any circumstances:
; php 5.4 and higher error_reporting = E_ALL ; php 5.3 and lower error_reporting = E_ALL & E_STRICT
If your code throws errors, you should fix it. Period.
Under most circumstances, it is safe to ignore
E_DEPRECATED
andE_STRICT
on “live” sites, provided you are fully aware of the reasons they are being thrown, and you have already accounted for them during development:During development, you want to see every last error.
display_errors = On
In production (i.e., when the site is “live”), no errors should be shown on the site.
display_errors = Off log_errors = On
September 6, 2013 at 12:24 am #149234Steven GardnerParticipantthanks for the feedback so far.
September 6, 2013 at 7:13 am #149259__ParticipantTypo in my code above.
; php 5.3 and lower
error_reporting = E_ALL & E_STRICT
should be
; php 5.3 and lower
error_reporting = E_ALL | E_STRICT
September 6, 2013 at 8:49 am #149278Steven GardnerParticipantThanks for clearing things up guys. Much appreciated.
Thanks Traq, I plan to go through each notice and try and fix the issue.
A long time ago I downloaded and plugged in a contact form script, made sure it worked fine put it live then forgot about it. This is the first time I’ve had to look at it in years.
I’m a front-end guy with coldfusion & sql experience.
September 27, 2013 at 2:45 am #149188Steven GardnerParticipant<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<META NAME=”keywords” CONTENT=”Dunfermline,Rosyth,Cairneyhill,Culross, Kincardine,Inverkeithing,Burntisland, Cowdenbeath,Kinghorn,Loghgelly,Kircaldy, Dysart,Buckhaven,Methill, Leven,Glenrothes,Leslie,Markinch,Saline,Carnock,Oakley, Conrie,Blairhall,Crossford,Torryburn, Limekilns,Crombie,Dalgety Bay,Crossgates, Clackmannan,Aloa,Queensferry,North Queensferry,Edinburgh,Limo,Limo Hire, Limousine Hire,Car Hire,Chauffeur Hire, Chauffeur Driven,Chauffeur Driven Car Hire,limo,
hire,dunfermline,exquisitelimousines,exquisite, limo,limousine,limousines,hire,fife, dunfermline,black,kirkcaldy,leven, glenrothes,edinburgh,stirling,falkirk, scotland,uk,travel,transport,wedding, crossford,lincoln,black,120,anniversaries, birthday,concert,prom,parties,shopping, trip,sport,night,town,hen,stag,casino, airport,transfer,tour,luxury,style,lincon, scottish,stretch,american,scotland, ecquisite,ezquisite,exquidite,exquiaite, exquisote,exquosite,exquisute,exquusite, limohiredunfermline”>
Limo Hire Leven, for cheap Limo Hire in Leven
<?php
/* ========================= Begin Configuration ============================ */
define("kContactEmail","[email protected]");
/* ========================= End Configuration ============================== */// init variables
$error_msg = 'The following fields were left empty or contain invalid information:- ‘;
- Full Name
- Phone Number
- E-mail Address
$error = false;// determine is the form was submitted
$submit = $_POST[‘submit’];
if (empty($submit))
$form_submitted = false;
else
$form_submitted = true;if ($form_submitted) {
// read out data
$name = $_POST[‘name’];
$date = $_POST[‘date’];
$email = $_POST[’email’];
$car = $_POST[‘car’];
$seats = $_POST[‘seats’];
$phone = $_POST[‘phone’];
$mobile = $_POST[‘mobile’];
$advert = $_POST[‘advert’];
$message = $_POST[‘message’];// verify required data
if(!$name) { $error_msg .= ““; $error = true; }
if(!$phone) { $error_msg .= ““; $error = true; }
if($email) { if(!eregi(“^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$”, $email)){ $error_msg .= ““; $error = true; }}
$error_msg .= ““;
// email message if no errors occurred
if (!$error) {
// prepare message
$msg = “Full Name: \t $name \n”;
$msg .= “Date of Hire: \t $date \n”;
$msg .= “E-mail Address: \t $email \n”;
$msg .= “Type of car: \t $car \n”;
$msg .= “Number of Seats: \t $seats \n”;
$msg .= “Phone Number: \t $phone \n”;
$msg .= “Mobile Number: \t $mobile \n”;
$msg .= “How did you hear about us: \t $advert \n”;
$msg .= “Message: \n—\n $message \n—\n”;$subject = “Website Contact Form Results”;
// prepare message header
$mailheaders = “MIME-Version: 1.0\r\n”;
$mailheaders .= “Content-type: text/plain; charset=iso-8859-1\r\n”;
$mailheaders .= “From: $name \r\n”;
$mailheaders .= “Reply-To: $name \r\n”;// send out email
mail(kContactEmail, $subject ,stripslashes($msg), $mailheaders);
}
}
?>
.Welcome to Exquisite Limousines
Get in touch for a limo hire quoteAddress:
13 Menteith Drive,
Dunfermline.
Fife.
KY11 8RRTelephone:
01383 731 322Mobile:07879 257 291
Website:http://www.exquisitelimousines.co.uk
Request a quote via text message for a rapid response between the hours of 9am & 9pm.
Simply TEXT the word "QUOTE" to 07879257291 and someone will phone you back to discuss your requirements.
—————————————————
Thank you for your feedback, .
This is the information you submitted:<?php
}
// display contact form
else {
// display error message
if ($error) {
echo "” . $error_msg . “\n”;
}
?>
Please fill out and submit the form on this page to contact us. We will get back to you
as soon as we can. Note that fields marked with * are
required fields.<form action="” method=”post” name=”contact”>
Full Name*
<input name="name" type="text" value="” size=”40″>Date of Hire
<input name="date" type="text" id="Date of Hire" value="” size=”30″>E-mail Address
<input name="email" type="text" value="” size=”40″>Phone Number*
<input name="phone" type="text" value="” size=”30″>Number of Seats Needed
<select name="seats" id="seats" >
1
2
3
4
5
6
7
8
— + 8 Requires 2 cars —
9
10
11
12
13
14
15
16
16+Mobile Number
<input name="mobile" type="text" id="mobile" value="” size=”30″ />How did you find us
<select name="advert" id="advert" value="”>
Choose OneGoogle
Yahoo!
MSN Search
AOL Search
Internet Yellow Pages
Other Search Engine – Indicate BelowFriend
Yellow Pages
Website Link – Indicate Below
Poster or Leaflet
Other – Indicate BelowType of car
<select name="car" id="car" >
Pink
BlackPlease provide us with any other information or special requests
Exquisite Limousines: Limo hire for any occasion.
13 Menteith Drive, Dunfermline
Fife Scotland KY11 8RR
Tel. 01383 731322
Mob. 07879 257291
Get Directions_uacct = “UA-3066057-1”;
urchinTracker(); -
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.