chico1st Posted July 26, 2006 Share Posted July 26, 2006 Hey I have this little script it is part of a bigger program but when i run it, it pretty much just prints the php code, which is odd.Here is my code:<?include "spyLib.php";$dbConn = connectToSpy();$fieldNames = "";$fieldValues = "";foreach ($_REQUEST as $fieldName => $value){ if ($fieldName == $_POST['tableName']){ $theTable = $value; } else { $fields[] = $fieldName; $values[] = $value; } // end if} // end foreachprint updateRec($theTable, $fields, $values);print mainButton();?>And the output is: (but all on one line)[b]Update Record[/b]$value){ if ($fieldName == $_POST['tableName']){ $theTable = $value; } else { $fields[] = $fieldName; $values[] = $value; } // end if} // end foreachprint updateRec($theTable, $fields, $values);print mainButton();?>(i also tried replacing the => with a ->... because i didnt know the difference) Any help would be awesome. SincerelyTHANKS! Quote Link to comment https://forums.phpfreaks.com/topic/15704-my-code-is-my-output/ Share on other sites More sharing options...
fenway Posted July 26, 2006 Share Posted July 26, 2006 Don't you need "<?php" at the beginning? Otherwise, your httpd server isn't set up properly to handle PHP scripts. Quote Link to comment https://forums.phpfreaks.com/topic/15704-my-code-is-my-output/#findComment-64113 Share on other sites More sharing options...
wildteen88 Posted July 26, 2006 Share Posted July 26, 2006 PHP may not have a setting called short_open_tag enabled which allows you to use <? as an opeing tag and <?= a shortcut for <?php echo . Try fenways suggestion by using the full opening tag <?php Quote Link to comment https://forums.phpfreaks.com/topic/15704-my-code-is-my-output/#findComment-64141 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.