|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
HTML in PHP script
I am trying to write PHP script that will edit,delete,search,list mysql data base. The script bellow.
I keep getting Parse error: parse error, unexpected T_STRING in /home/bizhive/public_html/FORMPROCESS1.php3 on line 45 . Anybody there to help me debug the code? <?php $Request=$_REQUEST['form']; $UserName = $_REQUEST['username']; $FirstName= $_REQUEST['firstname']; $middlename = $_REQUEST['middlename']; $lastname = $_REQUEST['lastname']; $password=$_REQUEST['password']; $yourtitle = $_REQUEST['yourtitle']; $streetaddress = $_REQUEST['streetaddress']; $streetaddresscontinue = $_REQUEST['streetaddresscontinue']; $city = $_REQUEST['city']; $state = $_REQUEST['state']; $zipcode = $_REQUEST['zipcode']; $country = $_REQUEST['country']; $homephone = $_REQUEST['homephone']; $workphone = $_REQUEST['workphone']; $fax = $_REQUEST['fax']; $email = $_REQUEST['email']; $organisation = $_REQUEST['organisation']; $maritalstatus = $_REQUEST['maritalstatus']; $occupation = $_REQUEST['occupation']; $religion = $_REQUEST['religion']; $others = $_REQUEST["others"]; $db =mysql_connect ("localhost", "bizhive_database", "pass") or die ('Having problem connecting to the database.'); mysql_select_db ("bizhive_nigeriangreenpage"); switch ($request) { Case 'search': mySQLquery("SELECT * From database where username='$username' or firstname='$firstname' or Middlename='$middlename' or lastname='$lastname' or yourtitle='$yourtitle' or streetname=='$streetname' or streenamecontinue='$streetnamecomntinue' or zipcode='$zipcode' or country='$country' or homephone='$homephone' or workphone='$workphone' or fax='$fax' or maritalstatus='$maritalstatus' or occupation='$occupation' or religion='$religion' or homepage='$homephage' or others='$others', $db) i = 1; ?>; <html> <head> <title>Search Result</title> </head> <body bgcolor="#009900" text="#FFFFFF"> <p align="left"> <marquee width="323" height="19" bgcolor="#009900" style="font-weight: bold">NIGERIANGREENPAGE DIRECTORY SEARCH RESULT</marquee> </p> <table border="1" width="35%"> <tr> <?PHP while ($myrow = mySQL_fetch_array($result)) { ? <td width="100%">SEAECH NUMBER"<?Php echo 'i'?></td> </tr> </table> <table border="1" width="100%"> <tr> <td width="35%">USER NAME: </td> <td width="65%"> "<?Php echo $myrow['username']?>"</td> </tr> <tr> <td width="35%">FIRST NAME</td> <td width="65%">"<?Php echo $myrow['firstname']?></td> </tr> <tr> <td width="35%">MIDDLE NAME:</td> <td width="65%">"<?Php echo $myrow['middlename']?></td> </tr> <tr> <td width="35%">LAST NAME:</td> <td width="65%">"<?Php echo $myrow['lastname']?></td> </tr> <tr> <td width="35%">TITLE:</td> <td width="65%">"<?Php echo $myrow['yourtitle']?></td> </tr> <tr> <td width="35%">STREET ADDRESS:</td> <td width="65%">"<?Php echo $myrow['streetaddress']?></td> </tr> <tr> <td width="35%">STREET ADDRESS CONTINUE:</td> <td width="65%">"<?Php echo $myrow['streetaddresscontinue']?></td> </tr> <tr> <td width="35%">CITY:</td> <td width="65%">"<?Php echo $myrow['city']?></td> </tr> <tr> <td width="35%">STATE:</td> <td width="65%">"<?Php echo $myrow['state']?></td> </tr> <tr> <td width="35%">ZIP CODE:</td> <td width="65%">"<?Php echo $myrow['zipcode']?></td> </tr> <tr> <td width="35%">COUNTRY:</td> <td width="65%">"<?Php echo $myrow['country']?></td> </tr> <tr> <td width="35%">HOME PHONE:</td> <td width="65%">"<?Php echo $myrow['homephone']?></td> </tr> <tr> <td width="35%">WORK PHONE:</td> <td width="65%">"<?Php echo $myrow['workphone']?></td> </tr> <tr> <td width="35%">FAX:</td> <td width="65%">"<?Php echo $myrow['fax']?>?</td> </tr> <tr> <td width="35%">E-MAIL:</td> <td width="65%">"<?Php echo $myrow['email']?></td> </tr> <tr> <td width="35%">ORGANISATION:</td> <td width="65%">"<?Php echo $myrow['organisation']?></td> </tr> <tr> <td width="35%">MARITAL STATUS:</td> <td width="65%">"<?Php echo $myrow['maritalstatus']?></td> </tr> <tr> <td width="35%">OCCUPATION:</td> <td width="65%">"<?Php echo $myrow['occupation']?></td> </tr> <tr> <td width="35%">RELIGION:</td> <td width="65%">"<?Php echo $myrow['religion']?></td> </tr> <tr> <td width="35%">HOME PAGE:</td> <td width="65%">"<?Php echo $myrow['homepage']?></td> </tr> <tr> <td width="35%">OTHERS:</td> <td width="65%">"<?Php echo $myrow['others']?></td> </tr> <tr> <td width="35%">RECORD NUMBER:</td> <td width="65%">"<?Php echo $myrow['userid']?></td> </tr> </table> </body> </html> <?php i= i + 1; } break; case 'register' : $sql = "INSERT INTO database (username,firstName,middlename,lastname,yourtitle, streetaddress,streetaddresscontinue,city,state,zip code,country,homephone,workphone,fax,email,organis ation,maritalstatus,occupation,religion,homepage,o thers) VALUES ('$firstname','$middlename','lastname','$yourtitle ','$streetaddress','$streetaddresscontinue','$city ,'$state,'$zipcode','$country,'$homephone','$workp hone,'$fax','$email','$organisation','$maritalstat us','$occupation','$religion','$homepage','$others ')"; $sqlresult = mysql_query($sql); $myrow = mySQL_fetch_array($sqlresult); ?> <html> <head> <title>DIRECTORY REGISTRATION</title> </head> <body bgcolor="#009900" text="#FFFFFF"> <p align="left"> <marquee width="323" height="19" bgcolor="#009900" style="font-weight: bold">NIGERIANGREENPAGE DIRECTORY REGISTRATION</marquee> </p> <p align="left"><font size="4">You registered with the information bellow:</font> </p> <table border="1" width="100%"> <tr> <td width="35%">USER NAME: </td> <td width="65%"> "<?Php echo $myrow['username']?>"</td> </tr> <tr> <td width="35%">FIRST NAME</td> <td width="65%">"<?Php echo '$firstname'?></td> </tr> <tr> <td width="35%">MIDDLE NAME:</td> <td width="65%">"<?Php echo '$middlename'?></td> </tr> <tr> <td width="35%">LAST NAME:</td> <td width="65%">"<?Php echo '$lastname'?></td> </tr> <tr> <td width="35%">TITLE:</td> <td width="65%">"<?Php echo '$yourtitle'?></td> </tr> <tr> <td width="35%">STREET ADDRESS:</td> <td width="65%">"<?Php echo '$streetaddress'?></td> </tr> <tr> <td width="35%">STREET ADDRESS CONTINUE:</td> <td width="65%">"<?Php echo '$streetaddresscontinue'?></td> </tr> <tr> <td width="35%">CITY:</td> <td width="65%">"<?Php echo '$city'?></td> </tr> <tr> <td width="35%">STATE:</td> <td width="65%">"<?Php echo '$state'?></td> </tr> <tr> <td width="35%">ZIP CODE:</td> <td width="65%">"<?Php echo '$zipcode'?></td> </tr> <tr> <td width="35%">COUNTRY:</td> <td width="65%">"<?Php echo '$country'?></td> </tr> <tr> <td width="35%">HOME PHONE:</td> <td width="65%">"<?Php echo '$homephone'?></td> </tr> <tr> <td width="35%">WORK PHONE:</td> <td width="65%">"<?Php echo '$workphone'?></td> </tr> <tr> <td width="35%">FAX:</td> <td width="65%">"<?Php echo '$fax'?</td> </tr> <tr> <td width="35%">E-MAIL:</td> <td width="65%">"<?Php echo '$email'?></td> </tr> <tr> <td width="35%">ORGANISATION:</td> <td width="65%">"<?Php echo '$organisation'?></td> </tr> <tr> <td width="35%">MARITAL STATUS:</td> <td width="65%">"<?Php echo '$maritalstatus'?></td> </tr> <tr> <td width="35%">OCCUPATION:</td> <td width="65%">"<?Php echo '$occupation'?></td> </tr> <tr> <td width="35%">RELIGION:</td> <td width="65%">"<?Php echo '$religion'?></td> </tr> <tr> <td width="35%">HOME PAGE:</td> <td width="65%">"<?Php echo '$homepage'?></td> </tr> <tr> <td width="35%">OTHERS:</td> <td width="65%">"<?Php echo '$others'?></td> </tr> <tr> <td width="35%">RECORD NUMBER:</td> <td width="65%">"<?Php echo $myrow['userid']?></td> </tr> </table> <p> <a href="http://www.nigeriangreenpage.com"> HOME</a></p> </body> </html> <?php break; case 'listing' : $sql = mysql_query(nigeriandatabase,$db); ?> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>DIRECTORY LISTING</title> </head> <body bgcolor="#009900" text="#FFFFFF"> <p align="left"> <marquee width="323" height="19" bgcolor="#009900" style="font-weight: bold">NIGERIANGREENPAGE DIRECTORY LISTING</marquee> </p> <p align="left"><font size="4">ALL DATABASE LISTED BELLOW:</font> </p> <table border="1" width="100%"> <tr> <?PHP while($myrow = mySQL_fetch_array($sql) { ?> <td width="35%">USER NAME: </td> <td width="65%"> "<?Php echo $myrow['username']?>"</td> </tr> <tr> <td width="35%">FIRST NAME</td> <td width="65%">"<?Php echo $myrow['firstname']?></td> </tr> <tr> <td width="35%">MIDDLE NAME:</td> <td width="65%">"<?Php echo $myrow['middlename']?></td> </tr> <tr> <td width="35%">LAST NAME:</td> <td width="65%">"<?Php echo $myrow['lastname']?></td> </tr> <tr> <td width="35%">TITLE:</td> <td width="65%">"<?Php echo $myrow['title']?></td> </tr> <tr> <td width="35%">STREET ADDRESS:</td> <td width="65%">"<?Php echo $myrow['streetaddress']?></td> </tr> <tr> <td width="35%">STREET ADDRESS CONTINUE:</td> <td width="65%">"<?Php echo $myrow['streetaddresscontinue']?></td> </tr> <tr> <td width="35%">CITY:</td> <td width="65%">"<?Php echo $myrow['city']?></td> </tr> <tr> <td width="35%">STATE:</td> <td width="65%">"<?Php echo $myrow['state']?></td> </tr> <tr> <td width="35%">ZIP CODE:</td> <td width="65%">"<?Php echo $myrow['zipcode']?></td> </tr> <tr> <td width="35%">COUNTRY:</td> <td width="65%">"<?Php echo $myrow['country']?></td> </tr> <tr> <td width="35%">HOME PHONE:</td> <td width="65%">"<?Php echo $myrow['homephone']?></td> </tr> <tr> <td width="35%">WORK PHONE:</td> <td width="65%">"<?Php echo $myrow['workphone']?></td> </tr> <tr> <td width="35%">FAX:</td> <td width="65%">"<?Php echo $myrow['fax']?>?</td> </tr> <tr> <td width="35%">E-MAIL:</td> <td width="65%">"<?Php echo $myrow['email']?></td> </tr> <tr> <td width="35%">ORGANISATION:</td> <td width="65%">"<?Php echo $myrow['organisation']?></td> </tr> <tr> <td width="35%">MARITAL STATUS:</td> <td width="65%">"<?Php echo $myrow['maritalstatus']?></td> </tr> <tr> <td width="35%">OCCUPATION:</td> <td width="65%">"<?Php echo $myrow['occupation']?></td> </tr> <tr> <td width="35%">RELIGION:</td> <td width="65%">"<?Php echo $myrow['religion']?></td> </tr> <tr> <td width="35%">HOME PAGE:</td> <td width="65%">"<?Php echo $myrow['homepage']?></td> </tr> <tr> <td width="35%">OTHERS:</td> <td width="65%">"<?Php echo $myrow['others']?></td> </tr> <tr> <td width="35%">RECORD NUMBER:</td> <td width="65%">"<?Php echo $myrow['userid']?></td> </tr> </table> <?php } ?> <p> <a href="http://www.nigeriangreenpage.com"> HOME</a></p> </body> </html> <?PHP break; case 'Delete' : "UPDATE database SET username''',firstname=''middlename='',lastName='', yourtitle='',streetaddress='',streetaddresscontinu e='',city='',state='',zipcode='',country='',Homeph one='',workphone='',fax='',Email='',organisation=' ',maritalstatus='',occupation='',religion='',homep age='',others='' WHERE username='$username'&&password='$password'" or echo 'No such record to delete, check your user name and password'; mySQLquery("SELECT * From database where username==$username&&password==$password) or die ("No record found delete succesful in nigeriangreenpage database!"); break; case 'update' : UPDATE database SET username''',firstname='$firstname'middlename='$mid dlename',lastName='$lastname',yourtitle='$yourtitl e',streetaddress='$streetaddress',streetaddresscon tinue='$streetaddresscontinue',city='$city',state= '$state',zipcode='$zipcode',country='$country',Hom ephone='$homephone',workphone='$workphone',fax='$f ax',Email='$email',organisation='$organisation',ma ritalstatus='$maritalstatus',occupation='occupatio n',religion='religion',homepage='homepage',others= 'others' WHERE username='$username'&&password='$password' or echo 'No such record to update, check your user name and password'; $sql= mySQLquery("SELECT * From database where username==$username&&password==$password) or die ("No record found update unsuccesful in nigeriangreenpage database!"); $myrow = mySQL_fetch_array($sql) ?> <html> <head> <title>Database Update Result</title> </head> <body bgcolor="#009900" text="#FFFFFF"> <p align="left"> <marquee width="323" height="19" bgcolor="#009900" style="font-weight: bold">NIGERIANGREENPAGE DIRECTORY UPDATE RESULT</marquee> </p> <table border="1" width="35%"> <tr> <td width="100%">NUMBER OF UPDATE 1"?></td> </tr> </table> <table border="1" width="100%"> <tr> <td width="35%">USER NAME: </td> <td width="65%"> "<?Php echo $myrow['username']?>"</td> </tr> <tr> <td width="35%">FIRST NAME</td> <td width="65%">"<?Php echo $myrow['firstname']?></td> </tr> <tr> <td width="35%">MIDDLE NAME:</td> <td width="65%">"<?Php echo $myrow['middlename']?></td> </tr> <tr> <td width="35%">LAST NAME:</td> <td width="65%">"<?Php echo $myrow['lastname']?></td> </tr> <tr> <td width="35%">TITLE:</td> <td width="65%">"<?Php echo $myrow['yourtitle']?></td> </tr> <tr> <td width="35%">STREET ADDRESS:</td> <td width="65%">"<?Php echo $myrow['streetaddress']?></td> </tr> <tr> <td width="35%">STREET ADDRESS CONTINUE:</td> <td width="65%">"<?Php echo $myrow['streetaddresscontinue']?></td> </tr> <tr> <td width="35%">CITY:</td> <td width="65%">"<?Php echo $myrow['city']?></td> </tr> <tr> <td width="35%">STATE:</td> <td width="65%">"<?Php echo $myrow['state']?></td> </tr> <tr> <td width="35%">ZIP CODE:</td> <td width="65%">"<?Php echo $myrow['zipcode']?></td> </tr> <tr> <td width="35%">COUNTRY:</td> <td width="65%">"<?Php echo $myrow['country']?></td> </tr> <tr> <td width="35%">HOME PHONE:</td> <td width="65%">"<?Php echo $myrow['homephone']?></td> </tr> <tr> <td width="35%">WORK PHONE:</td> <td width="65%">"<?Php echo $myrow['workphone']?></td> </tr> <tr> <td width="35%">FAX:</td> <td width="65%">"<?Php echo $myrow['fax']?>?</td> </tr> <tr> <td width="35%">E-MAIL:</td> <td width="65%">"<?Php echo $myrow['email']?></td> </tr> <tr> <td width="35%">ORGANISATION:</td> <td width="65%">"<?Php echo $myrow['organisation']?></td> </tr> <tr> <td width="35%">MARITAL STATUS:</td> <td width="65%">"<?Php echo $myrow['maritalstatus']?></td> </tr> <tr> <td width="35%">OCCUPATION:</td> <td width="65%">"<?Php echo $myrow['occupation']?></td> </tr> <tr> <td width="35%">RELIGION:</td> <td width="65%">"<?Php echo $myrow['religion']?></td> </tr> <tr> <td width="35%">HOME PAGE:</td> <td width="65%">"<?Php echo $myrow['homepage']?></td> </tr> <tr> <td width="35%">OTHERS:</td> <td width="65%">"<?Php echo $myrow['others']?></td> </tr> <tr> <td width="35%">RECORD NUMBER:</td> <td width="65%">"<?Php echo $myrow['userid']?></td> </tr> </table> </body> </html> break; default : ?> <head> <title>Nigeriangreenpage Register Edit Delete Search</title> </head> <body bgcolor="#009900" text="#FFFFFF"> <h1 align="center">NIGERIANGREENPAGE</h1> <hr> <p align="center"> <marquee style="text-decoration: blink; font-weight: bold; font-size: .5in" bgcolor="#009900" width="418" height="55">The option botton is very important. The default is register. Thank you!</marquee> </p> <form name="Free Registration" onsubmit method="POST" action="formprocess.php3"> <p><b><font size="4"><u>Select what you want to do'</u></font></b></p> <b><blink><font color="#FF0000" size="5">What do you want to do?</font></blink></b> <p> <input type="checkbox" name="form" value="search"><b><font color="#FF0000">Search</font> </b> <input type="checkbox" name="form" value="register"> <font color="#FF0000"><b>Register</b></font> <input type="checkbox" name="form" value="listing"><font color="#FF0000"><b>Listing</b></font> <input type="checkbox" name="form" value="delete"><b><font color="#FF0000">Delete <input type="checkbox" name="form" value="update">Update</font></b></p> <blockquote> <table> <tbody> <tr> <td align="right"><em><b><font size="4">User Name:</font></b></em></td> <td><input size="60" value="I beg wating be the user name" name="UserName"></td> </tr> <tr> <td align="right"><em><b><font size="4">Password:</font></b></em></td> <td><input size="60" value="password" name="Password" type="password"></td> </tr> <tr> <td align="right"><em><b><font size="4">Password:</font></b></em></td> <td><input size="60" value="password" name="Password1" type="password"></td> </tr> <tr> <td align="right"><em><b><font size="4">First Name</font></b></em></td> <td><input size="60" value="Wating be the First Name?" name="FirstName"></td> </tr> <tr> <td align="right"><em><b><font size="4">Last Name</font></b></em></td> <td><b><font size="4"><input size="60" value="Wating be Last Name?" name="LastName"></font></b></td> </tr> <tr> <td align="right"><em><b><font size="4">Middle Initial</font></b></em></td> <td><input maxLength="1" size="60" value="Wating be Middle Name?" name="MiddleName"></td> </tr> <tr> <td align="right"><em><b><font size="4">Title</font></b></em></td> <td><input size="60" value="Wating be the Title? u be Chief, Bale,..." name="Title"></td> </tr> <tr> <td align="right"><em><font size="4"><b>Street Address</b></font></em></td> <td><input size="60" value="The street address?" name="StreetAddress"></td> </tr> <tr> <td align="right"><em><b><font size="4">Address (cont.)</font></b></em></td> <td><input size="60" value="Oga, the address dey long? continue... " name="StreetAddressContinue"></td> </tr> <tr> <td align="right"><em><b><font size="4">City</font></b></em></td> <td><input size="60" value="Which City be that?" name="City"></td> </tr> <tr> <td align="right"><em><b><font size="4">State/Province</font></b></em></td> <td><input size="60" value="I beg, the State o!" name="State"></td> </tr> <tr> <td align="right"><em><b><font size="4">Zip/Postal Code</font></b></em></td> <td><input maxLength="12" size="60" value="no be for naija. u get?" name="ZipCode"></td> </tr> <tr> <td align="right"><em><b><font size="4">Country</font></b></em></td> <td><input size="60" value="Which Country u dey?" name="Country"></td> </tr> <tr> <td align="right"><i><b><font size="4">Home Phone</font></b></i></td> <td><input maxLength="25" size="60" value="wating be the home fone?" name="HomePhone"></td> </tr> <tr> <td align="right"><em><b><font size="4">Work Phone</font></b></em></td> <td><input maxLength="25" size="60" value="Work fone dey?" name="WorkPhone"></td> </tr> <tr> <td align="right"><em><b><font size="4">FAX</font></b></em></td> <td><input maxLength="25" size="60" value="Fax dey?" name="Fax"></td> </tr> <tr> <td align="right"><em><b><font size="4">E-mail</font></b></em></td> <td><input size="60" value="e-mail na new thing o! u fit get one free @nigeriangreenpage.com" name="Email"></td> </tr> <tr> <td align="right"><em><b><font size="4">Organisation</font></b></em></td> <td><input size="60" value="Which Organisation ?" name="Organization"></td> </tr> <tr> <td align="right"><b><font size="4"><i>Occupation</i> </font></b></td> <td><input size="60" value="Oga, wating be una Job?" name="Occupation"></td> </tr> <tr> <td align="right"><i><b><font size="4">Religion</font></b></i></td> <td><input size="60" value="Oga Sir, Madam, which religion u dey?" name="Religion"></td> </tr> <tr> <td align="right"><font size="3"><b>Marital Status</b></font></td> <td><input size="60" value="married or single?" name="MaritalStatus"></td> </tr> <tr> <td align="right"><em><b><font size="4">URL</font></b></em></td> <td><input size="60" value="check nigeriangreenpagedotcom for urname.nigeriangreenpage.com" name="HomePage"></td> </tr> <tr> <td align="right"><i><b><font size="4">Others</font></b></i></td> <td><input maxLength="25" size="60" value="more tori?" name="Others"></td> </tr> </tbody> </table> </blockquote> <p> <input type="submit" value="Submit Form"> <input type="reset" value="Reset Form"> </p> </form> <hr> <h5>Omo Yin<br> Copyright © 2002[FastLinks]. All rights reserved.<br> Revised: <!--webbot bot="TimeStamp" S-Type="EDITED" S-Format="%B %d, %Y" --> </h5> </body> <?PHP } ?> |
|
#2
|
|||
|
|||
|
RE: HTML in PHP script
on line 36:
?>; should only be ?> line 34 needs a semicolon at the end. line 35 needs a $ at in front of the variable.. line 55 is: ? needs to be: ?> I'd suggest going line by line of this script and look for errors, it seems to have quite a few... |
|
#3
|
|||
|
|||
|
RE: HTML in PHP script
i made the coorection matt gave me but am still getting the error
|
|
#4
|
|||
|
|||
|
RE: HTML in PHP script
Just general coding advice:
When you write your code, write it in chunks. I mean, write a little, test it write a little more test it again.... This is one of the first things they taught me in college, I know many think it will save you time by writing it all at once then trying to run it, but in the long run it doesn't. -Sager |
|
#5
|
|||
|
|||
|
RE: HTML in PHP script
What is the exact error you are getting. If yo are using vi turn on line numbering (<esc> :set nu )Are there spelling mistakes in this line?
mySQLquery("SELECT * From database where username='$username' or firstname='$firstname' or Middlename='$middlename' or lastname='$lastname' or yourtitle='$yourtitle' or streetname=='$streetname' or streenamecontinue='$streetnamecomntinue' or zipcode='$zipcode' or country='$country' or homephone='$homephone' or workphone='$workphone' or fax='$fax' or maritalstatus='$maritalstatus' or occupation='$occupation' or religion='$religion' or homepage='$homephage' or others='$others', $db) Middlename (Capital letter "M") $homephage (Should it be homepage?) |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > HTML in PHP script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|