Jump to content

Having weird problem...


Dooglas

Recommended Posts

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.

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.