•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,752 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1258 | Replies: 11
![]() |
•
•
Join Date: Dec 2007
Posts: 28
Reputation:
Rep Power: 1
Solved Threads: 0
Hi all
I m using following code..
and getting arror as--
Parse error: syntax error, unexpected $end in /home/esolutio/public_html/enquirycaptcha.php on line 1
i m not getting where is the problem..
plz reply.
I m using following code..
<?php
session_start();
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABEFHKMNRVWX';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
$_SESSION['captcha'] = $stringa;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
</head>
<body>
<table width="100" height="54" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" id="Table_01">
<tr>
<td height="39" align="left" valign="top" class="imagesstyle"><h1 class="style2"><img src="3EImages/dot3E.jpg" alt="" width="29" height="29" align="left" class="imagesstyle" />General Enquiry<br />
</h1>
<td height="39" valign="top" style="padding-top: 5px"><a href="http://www.3esolutionsindia.com/" target="_blank">Home</a></td>
</td>
</tr>
<tr>
<td align="left" valign="top" class="tableDetail"><p><img src="3EImages/ContactUs/Enquiry.jpg" width="170" height="124" align="right" class="imgbrdr" /><strong>Thanks for showing interest in 3E Solutions.</strong> <br />
<br />
Kindly fill all the required fields. We will get in touch with you within 24 hours.</p>
<p> </p>
<form id="captchaform" action="enquiry.php" method="post" style="width:300px;">
<p align="right"> <label>
*Name:
<input type="text" name="name" id="name" size="30"/>
</label></p>
<p align="right">*Email Address:
<label>
<input type="text" name="email" id="email" size="30" />
</label>
</p>
<p align="right">Phone No:
<label>
<input type="text" name="phone" id="phone" size="30" />
</label>
</p>
<p align="right" style="">Interseted in:
<label>
<textarea name="interested" cols="30" rows="6" wrap="physical" id="interested">
</textarea>
</label>
</p>
<p align="right">
<div id="captcha">
<p align="right"><img src="captcha.php" /> </p>
<p align="right"><label for="code">*Enter Code: </label>
<input type="text" name="code" id="code" size="30" /></p>
</div>
</p>
<p align="right"><input type="submit" name="button" id="button" value="Submit" style="font-size:small;color: black;" /> </p>
</form>
</td>
</tr>
</table>
</body>
</html>
Parse error: syntax error, unexpected $end in /home/esolutio/public_html/enquirycaptcha.php on line 1
i m not getting where is the problem..
plz reply.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
I ran your script and I didn't get any error. Maybe you are getting the error because there is no space after •
•
•
•
if(!isset($_SESSION['captcha'])){session_register('captcha');}
php Syntax (Toggle Plain Text)
if(!isset($_SESSION['captcha'])){ session_register('captcha'); }
Cheers,
Naveen
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Feb 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
unexpected generaly means youve missed a '}' somwhere and php parser has reached the end of the script expecting it get used to error checking
1) get a decent text editor i use textpad which is so so.
2) using your new editor remove parts of code and trial the script until it runs smoothly that way you will narrow down the location of the error.
3) if you find you have messed your script up just (ctrl z)undo it and it will regress to its former state
im fairly new at php but there hasnt been an error that hasnt got passed my 'trial and error' above. hope i helped
1) get a decent text editor i use textpad which is so so.
2) using your new editor remove parts of code and trial the script until it runs smoothly that way you will narrow down the location of the error.
3) if you find you have messed your script up just (ctrl z)undo it and it will regress to its former state
im fairly new at php but there hasnt been an error that hasnt got passed my 'trial and error' above. hope i helped
•
•
Join Date: Feb 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
ORIGINAL
<?php
session_start();
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABEFHKMNRVWX';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
FIXED
<?php
session_start();
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABEFHKMNRVWX';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} }else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
<?php
session_start();
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABEFHKMNRVWX';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
FIXED
<?php
session_start();
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABEFHKMNRVWX';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} }else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
Last edited by cmarkme : Feb 16th, 2008 at 3:36 am. Reason: IGNORE I MADE A MISTAKE
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
•
•
•
•
ORIGINAL
<?php
session_start();
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABEFHKMNRVWX';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
FIXED
<?php
session_start();
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABEFHKMNRVWX';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} }else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
That wouldn't fix anything. There is a } at the end which is for 'for loop'. You just closed the 'for loop' after 'if loop'. That would generate an error
•
•
•
•
Parse error: syntax error, unexpected T_ELSE
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
That's strange! do you have error_reporting turned on on your local system ?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
Open php.ini and search for display_errors. If its off, turn it On. Then look for error_reporting. Uncomment this line.
Or, add
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT. Or, add
ini_set("display_errors","On"); error_reporting(E_ALL); in your script. Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- login form and MySQL connection/validation error (PHP)
- Parse error: syntax error, unexpected $end in (PHP)
- Unexpected error that doesn't exist (PHP)
- Help Needed Parse error: syntax error (PHP)
- syntax error, unexpected $end in ndex.php on line 127 (PHP)
- Syntax error,plz help (PHP)
- Parse error: syntax error, unexpected T_STRING (PHP)
Other Threads in the PHP Forum
- Previous Thread: HELP - Image Upload
- Next Thread: Need PHP/MYSQL database help



Linear Mode