Dooglas Posted April 25, 2008 Share Posted April 25, 2008 I just transfered my site over to a new server as my old one was extreamly slow and was my friends. So I decided to buy my own. But ever since I transfered all the files over all my scripts seeem to be acting different. For example: My registration script works fine on my old server (http://www.azarak.net/hockey/signup.php) but after transfering it to my new server (http://www.onlinehockey.org/signup.php) I try to fill out the form and all it does is seem to clear the form. But I can tell the page is being reloaded as it is saying in the URL http://www.onlinehockey.org/signup.php?action=done or whatever... but it isnt recognizing the php or something... Im pretty sure its the same php versions... But if anyone could test it out and get back to me that would be great as I just paid $100 for this new server and domain and don't want to have to try and get my money back and find a new one. Quote Link to comment Share on other sites More sharing options...
dptr1988 Posted April 25, 2008 Share Posted April 25, 2008 Transferring scripts between servers (espcially if they are poorly written) usally requires carefull testing and modifications to the script. I don't think that there is anything wrong with your new server. You need to debug this script. Can you show us any error messages? Quote Link to comment Share on other sites More sharing options...
Dooglas Posted April 25, 2008 Author Share Posted April 25, 2008 The thing is I'm not getting any errors... But I did just recognize that I was using PHP4 on my old server and now my server is using PHP5... is there significant difference that I have to make with my code for this change? I am sorry for the newbish questions I kind of just taught my self PHP by playing around with it.. I don't really have any training. Any help is greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Dooglas Posted April 25, 2008 Author Share Posted April 25, 2008 anyone? Quote Link to comment Share on other sites More sharing options...
Dooglas Posted April 25, 2008 Author Share Posted April 25, 2008 Okay here is an example of the problem with the code included... I have a test script of just a form... <?php if($action=="") { echo "<form action=tester.php?action=done METHOD=POST>"; echo "<b>Number</b><br>"; echo "<INPUT type=text name=name size=12 maxlength=16><br>"; echo "<INPUT type=submit name=submit value=done size=14>"; echo "</form>"; } if($action=="done") { echo "Your number is $name!"; } ?> now heres that code in action www.onlinehockey.org/tester.php I would expect that one you press submit $action is equal to done so it would display your number but it doesnt... Anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
dptr1988 Posted April 25, 2008 Share Posted April 25, 2008 Does your code expect register globals to be turned on? Register globals should NOT be turned on, and if you old code depends on it, and your new server doesn't have it turned it ( the better not!! ) then it would break your code. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 25, 2008 Share Posted April 25, 2008 You're assuming that register_globals is enabled. In PHP5 this is disabled by default (and it should be left that way). You need to use the superglobal array $_POST and/or $_GET instead: [code<?php if($_GET['action']=="") { echo '<form action="tester.php?action=done" METHOD="POST">'; echo "<b>Number</b><br>"; echo "<INPUT type='text' name='name' size=12 maxlength=16><br>"; echo "<INPUT type='submit' name='submi't value='done' size=14>"; echo "</form>"; } if($_GET['action']=="done") { echo 'Your number is ' . $_POST['name'] . "'!"; } ?> You should also learn to wrote correct HTML and put all of the form attributes in quotes. Ken Quote Link to comment Share on other sites More sharing options...
Dooglas Posted April 25, 2008 Author Share Posted April 25, 2008 heh wow I feel pretty dumb for that... I guess I should go fix up my code. Thanks a ton for your help! Quote Link to comment 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.