franknu Posted March 23, 2007 Share Posted March 23, 2007 well i have a update session that is not updating i thought because i had diffrent form running now i try to created with the server['hp_self]; ?> but i was getting a sytax error here is the code $query = "SELECT * FROM business_info WHERE `BusinessName`= '$BusinessName' AND `User_Name`='$User_Name'"; $result = mysql_query($query) or die (mysql_error()); $res2 = mysql_fetch_assoc($result); echo "$BusinessName"; if(isset($_GET['update'])) { $query="UPDATE business_info SET `BusinessName`= '$BusinessName', `Slogan`='{$Slogan}', `Business_Address`='{$Business_Address}', `Tel`='{$Tel}', `Website`='$Website', `Email`='{$Email}', `Fax`='{$Fax}', `type`='{$type}', `make`='{$make}', `Categories`='{$Categories}', `Keyword`='{$Keyword}', `Picture1`='{$Picture1}', `Headline`='{$Headline}', `Slogan2`='{$Slogan2}', `Description1`='{$Description1}', `Description2`='{$Description2}', `Description3`= '{$Description3}', `Picture2`='{$Picture2}', `Picture3`='{$Picture3}', `Password`='{$Password}' WHERE `User_Name`='{$User_Name}'"; $result = mysql_query($query) or die (mysql_error()); } echo"<table bgcolor='ffffff'>"; echo"<tr>"; echo"<td>"; echo"<table>"; echo"<tr>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td></td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<table> "; echo" <tr>"; echo"<td>"; echo"<table bgcolor='ffffff '>"; echo" <tr>"; echo"<td>"; echo"<table>"; // Hre is where is the error echo"<form action='<? PHP $_SERVER['PHP_SELF'] ; ?>' method='Post'>"; echo"<tr>"; echo"<td>"; echo"Business Info"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"Business Name"; echo"</td>"; echo"<td><input type='text' name='BusinessName' Value='$BusinessName'>"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Slogan"; echo"</td>"; echo"<td> <input type='text' NAME='Slogan' value='$Slogan'>"; echo" </td>"; echo"<td>"; echo"Website"; echo"</td>"; echo"<td> <input type='text' name='Website' value='$Website'>"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Tel"; echo"</td>"; echo"<td> <input type='text' name='Tel' value='$Tel'>"; echo"</td>"; echo"<td>"; echo"Key Words"; echo"</td>"; echo"<td> <input type='text' name='Keyword' value='$Keyword'>"; echo "</td>"; echo" </tr>"; echo"<tr>"; echo"<td>"; echo"Fax"; echo"</td>"; echo"<td> <input type='text' name='Fax' value='$fax'>"; echo" </td> "; echo"<td>"; echo"Address" ; echo"</td>"; echo"<td> <input type='text' name='Business_Address' value='$Business_Address'>"; echo" </td>"; echo" </tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"</td>"; echo"<td>"; echo"</td>"; echo"<td>"; echo"</td>"; echo"<td> "; echo"</td>"; echo"<td>"; echo"Category"; echo"</td>"; echo"<td>"; echo" <TEXTAREA ROWS=5 COLS=65 NAME='Categories' value='$Categories'> $Categories </TEXTAREA>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"Business Webpage"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Headline"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo" <td> <input type='text' name='Headline' value='$Headline'>"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Slogan"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td> <input type='text' name='Slogan2' value='$Slogan2'>"; echo"</td>"; echo" </tr>"; echo"<tr>"; echo" <td>"; echo"Description1"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<TEXTAREA ROWS=5 COLS=65 NAME='Description1' value='$Description1'>$Description1 </TEXTAREA> "; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Description2"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td> <TEXTAREA ROWS=5 COLS=65 NAME='Description2' value='$Description2'>$Description2</TEXTAREA>"; echo"</td>"; echo"</tr>"; echo" <tr>"; echo"<td>"; echo"Description3"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td><TEXTAREA ROWS=5 COLS=65 NAME='Description3' value='$Description3'>$Description3</TEXTAREA>"; echo"</td>"; echo"</tr>"; echo" <tr>"; echo" <td>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"User Name"; echo"</td>"; echo"<td> <input type='text' name='User_Name' value='$User_Name'>"; echo"</td>"; echo"<td>"; echo"Password"; echo"</td>"; echo"<td> <input type='text' name='Password' value='$Password'>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td> <input type='submit' value='Update my database' name='update' /> <input type='reset' value='Reset fields' />"; echo"<td> "; echo"</form>"; echo"</table>"; echo"</td>"; echo"<td>"; echo"</td>"; echo" </tr>"; echo"</table>"; echo"</td>"; echo"</table> " ; echo" </tr>"; //finish here echo "<td> </td>"; echo"</td>"; echo"<td valign='top'>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"</table>"; } ?> here is my display Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/townsfin/public_html/authorization/Update_Page.php on line 242 please help Link to comment https://forums.phpfreaks.com/topic/44049-action/ Share on other sites More sharing options...
suzzane2020 Posted March 23, 2007 Share Posted March 23, 2007 Which is line 24? Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213888 Share on other sites More sharing options...
AndyB Posted March 23, 2007 Share Posted March 23, 2007 // Hre is where is the error echo"<form action='<? PHP $_SERVER['PHP_SELF'] ; ?>' method='Post'>"; Should be: echo "<form action='". $_SERVER['PHP_SELF']. "' method='Post'>"; Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213889 Share on other sites More sharing options...
HaLo2FrEeEk Posted March 23, 2007 Share Posted March 23, 2007 Nope, this: echo "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"POST\">"; Is what you want. I've tried your way andy, and it doesn't seem to work very well, this is what I have always used and I've never once had a problem. Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213890 Share on other sites More sharing options...
fert Posted March 23, 2007 Share Posted March 23, 2007 Damn, you guys beat me to it Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213891 Share on other sites More sharing options...
franknu Posted March 23, 2007 Author Share Posted March 23, 2007 well, the last one worked the only problem now is that it is not updating any idea, how i can fix that Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213894 Share on other sites More sharing options...
AndyB Posted March 23, 2007 Share Posted March 23, 2007 Probably because you've assumed register_globals is ON when it is OFF by default in recent versions of php. You need to abstract the values passed from the form out of the $_GET array (or $_POST array if that's the form method) Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213901 Share on other sites More sharing options...
franknu Posted March 23, 2007 Author Share Posted March 23, 2007 well i get the data from the database to display on the text box, the problem is that when i hit update database it is not updating Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213907 Share on other sites More sharing options...
AndyB Posted March 24, 2007 Share Posted March 24, 2007 One step at a time. You retrieve data from the database and use that to display in the form. You then (presumably) edit some of the information and submit the form. The values that you want to put back into the database are in the $_POST() array unless your server has register_globals set to ON (an insecure and outmoded practice). So, for example, the actual value of the POSTed variable named email is not $email, it's $_POST['email']. Similarly for all other values in the form. You can check what's actually happening to your query by adding a line to echo $query. Then you'll see exactly what the query string is. The query at the top of your code probably isn't returning any data because the variables in the query aren't set. Echo that one as well to see what's really in it. Link to comment https://forums.phpfreaks.com/topic/44049-action/#findComment-213982 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.