Page 1 of 1
Problem testing PHP with local setup
Posted: Sat Nov 08, 2008 8:09 am
by intacom49
Hi, I have a setup on my local machine to test out before I post. (WINXP, Apache2.2, PHP5 and MySQL5). Usinging PHP to write and read to a form works OK when I upload to my ISPs Linux server but same code won't work locally. For example text and list boxes don't fill and I get text displayed in text ones e.g <? echo addslashes($_POST['un']); ?> shows in the 'Username box' of my login form.
Anyone got any ideas why?
Re: Problem testing PHP with local setup
Posted: Sat Nov 08, 2008 2:47 pm
by califdon
Not without seeing your code.
Re: Problem testing PHP with local setup
Posted: Sat Nov 08, 2008 3:44 pm
by VladSun
Try with long PHP tag:
Code: Select all
<?php echo addslashes($_POST['un']); ?>
Re: Problem testing PHP with local setup
Posted: Tue Nov 11, 2008 4:46 am
by intacom49
This is the logon form..Works fine on the remote server but not locally. Can't be the code surely! Tried the 'long' tag...Same result.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Newsletter</title>
<link rel="stylesheet" type="text/css" href="standard.css">
</head>
<body>
<div class="login">
<font class="redf"><?php echo $sm; ?></font>
<form method="post" action="index.php"><input type="hidden" name="act" value="login">
<table class="t1">
<tr>
<th class="thrnl" width="40%">Username</th>
<td class="thlnl" width="60%"><input type="text" name="un" size="20" value="<? echo addslashes($_POST['un']); ?>"></td>
</tr>
<tr>
<th class="thrnl" width="40%">Password</th>
<td class="thlnl" width="60%"><input type="password" name="pw" size="20"></td>
</tr>
<tr>
<td colspan="2" class="thrnl"><input type="submit" name="Submit" value="Submit"> </td>
</tr>
</table>
</form>
</div>
</body>
</html>
Re: Problem testing PHP with local setup
Posted: Tue Nov 11, 2008 4:52 pm
by califdon
What you have shown would not, by itself, include any data in the form, regardless of what server it runs on. It's all HTML, other than 2 brief spurts of PHP code, which refer to variables that are not defined in the code, so there would be nothing to add to the HTML (and you only used the long tag on the first occurrence of PHP code). My guess is that you haven't shown us all the code, and very likely what you haven't shown us may incorporate some other "include" files that you don't have on your local server. All in all, I think the problem here is that you haven't any experience with using PHP. That makes it quite difficult to bring you up to speed in a couple of forum postings to what takes months of study to learn.