Jump to content

newbie with problem


education5866

Recommended Posts

Okay...my server is running php5, but I am getting a parse error message:

Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/gcc/public_html/pro-php/admin/AddCat.php on line 44

 

Here's the phpcode for that page (I've marked line 44):

<?php
require_once("../db.php");
include("Header.php");
$db = new db_layer();
$db->getConnection();

if($_SERVER['REQUEST_METHOD'] == "POST")
{
$catName = $_POST["catName"];

if($catName == "")
{
	$formError = "1";
}	
else
{
	$qry = "insert into mag_name(name) values('".str_replace("'","",$catName)."')";
	$db->execute_sql($qry,$result,$error_msg);
	if($error_msg <> "")
	{
		echo $error_msg;
	}
	else
	{	
            $new_id = mysql_insert_id();
		?>
            	<script language="javascript" type="text/javascript">
			document.location.href="AddMag.php?CatID=<?php echo $new_id ?>";
			</script>
            <?php
		die;
	}
}
}
?>
<table width="600" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#666666">
  <Form name="NewCategory" method="post" action="../../pro-php/admin/?Process=AddCat"><tr>
    <td colspan="2" bgcolor="#222222"><span style="font-family: Tahoma, Verdana, sans-serIf; font-size:20px; font-weight:bold">Add Category</span></td>
  </tr>
  <?php
  if($FormError == "1")
  {
  ?>  
[u][b]LINE44 [/b][/u] <%If Request("Process")="AddCat" and FormError=1 Then%><tr>
      <td colspan="2" align="center" bgcolor="#222222" style="font-family: Tahoma, Verdana, sans-serIf; font-size:16px; color:#f30">*<p>missing information! category name required...</p></td>
    </tr>
  <?php
   }
   ?>
    <tr>
      <td width="30%" align="right" bgcolor="#222222" style="font-family: Tahoma, Verdana, sans-serIf; font-size:18px">Category Name:</td>
      <td bgcolor="#222222"><input name="catName" type="text" id="catName" style="font-family:Verdana, Arial, Helvetica, sans-serIf; font-size:16px; padding:3px; width:350px; height:30px" maxlength="100"></td>
    </tr>
  <tr>
    <td align="right" bgcolor="#222222"> </td>
    <td bgcolor="#222222"><input type="submit" name="Submit" value="Submit" style="font-family: Tahoma, Verdana, sans-serIf; font-size:16px"></td>
  </tr></Form>
</table>
<?php
include("Footer.php");
?>

 

If anyone can figure out why I'm getting a parse error in this php file, I would greatly appreciate it!

Thanks in advance!

NewbieToPhp

Link to comment
https://forums.phpfreaks.com/topic/139907-newbie-with-problem/
Share on other sites

<%If Request("Process")="AddCat" and FormError=1 Then%>

 

Looks like it is an ASP line. That is not valid php.

 

Thanks for the quick reply...

Can you figure out how to put that line back 'into' PHP...I got the code from somewhere else and don't have access to other support?

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/139907-newbie-with-problem/#findComment-731964
Share on other sites

  if($FormError == "1" && $_REQUEST['Process'] == "AddCat")
  {
  ?> 
    <tr>
      <td colspan="2" align="center" bgcolor="#222222" style="font-family: Tahoma, Verdana, sans-serIf; font-size:16px; color:#f30">*<p>missing information! category name required...</p></td>
    </tr>

 

Should solve it.

Link to comment
https://forums.phpfreaks.com/topic/139907-newbie-with-problem/#findComment-731987
Share on other sites

  if($FormError == "1" && $_REQUEST['Process'] == "AddCat")
  {
  ?> 
    <tr>
      <td colspan="2" align="center" bgcolor="#222222" style="font-family: Tahoma, Verdana, sans-serIf; font-size:16px; color:#f30">*<p>missing information! category name required...</p></td>
    </tr>

 

Should solve it.

 

Premiso...wow!  Thanks alot for your help.  Hopefully, someday I'll have enough PHP knowledge to help someone else on this board.

Thanks again!

Education ;D

Link to comment
https://forums.phpfreaks.com/topic/139907-newbie-with-problem/#findComment-732408
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.