$_POST won't work.

Discussion in 'PHP' started by countrydj, Mar 31, 2011.

  1. #1
    Hi Guys...

    I have 2 identical forms and scripts, both running on the same server running php5 and centos5 operating system.
    The forms are for collecting email addresses and the script is for entering the email addresses into the database (mysql)

    radio site = http://bcmi-radio.co.uk
    country site = http://countrymusic.org.uk

    The radio site uses $_POST to pass information to it's script, but $_POST will NOT work for the country site.

    Both forms and scripts are identical except for the form action.
    radio site form:
    <form action="http://www.bcmi-radio.co.uk/mail/register-exec.php" target="new" method="POST">
    country site:
    <form action="http://www.countrymusic.org.uk/mail/register-exec.php" target="new" method="POST">

    Both scripts are using $_REQUEST for receiving the variables
    The datbases are identical except for the DB name. The tables are the same.

    If I change the country site forn action to:
    <form action="http://www.countrymusic.org.uk/mail/register-exec.php" target="new" method="GET">
    The script works.

    Can anybody tell me why this should happen ???

    I don't need the information to get the form to work, but it is driving me mad trying to figure out why it would happen.

    Thanks,

    John C
     
    countrydj, Mar 31, 2011 IP
  2. AlC4Tr4z

    AlC4Tr4z Member

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    At this moment you have an error in the destination page.
    Failed to connect to server: Access denied for user 'bcmi-list'@'localhost' (using password: YES)

    Error could be the 301 redirect.
    Your action is: http://www.countrymusic.org.uk/mail/register-exec.php but your apache(maybe in .htaccess config) perform a redirect to http://countrymusic.org.uk/mail/register-exec.php (your domain without www).

    Check that, change action to http://countrymusic.org.uk/mail/register-exec.php (your domain without www). and check if $_POST is ok.

    Cheers
     
    AlC4Tr4z, Apr 1, 2011 IP
  3. countrydj

    countrydj Active Member

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    Hi AlC4Tr4z..

    THank you for taking the trouble and time to reply.

    Sorry about the error.
    I changed the DB_USER but forgot to change the config.php file.
    I have now put it right.
    "Check that, change action to http://countrymusic.org.uk/mail/register-exec.php (your domain without www). and check if $_POST is ok."
    I have changed the form action to:
    <form action="http://countrymusic.org.uk/mail/register-exec.php" target="new" method="POST">​

    code and tested it and it now works.

    Very many thanks for your help and advise.

    I willl now be able to sleep OK.

    Regards,

    John C
     
    countrydj, Apr 1, 2011 IP
  4. leunamer

    leunamer Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    or try to use relative url in form action
    <form action="/mail/register-exec.php" target="new" method="POST">
    Code (markup):
     
    leunamer, Apr 1, 2011 IP
  5. AlC4Tr4z

    AlC4Tr4z Member

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #5
    Nada :)

    Anyway I think it's better to check all your code and use only a domain style(with or without the www.) and redirect the other one to the choose one.
    It's better for SEO purpose as well.

    Regards
    Rosario
     
    AlC4Tr4z, Apr 1, 2011 IP