Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Form Submit Error[PLEASE HELP!!]

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45016

    i am having a profile.php page and in that page i am having a form but it’s action is not working correctly.

    The code is(i have all <> in the form code below but it’s not here as it was not showing so i removed them)-

    “>


    But when i click on add as friend or send message it sends me to :-
    http://rahulkapoor.webege.com/profile.php?addfriend=Add+as+Friend instead i want to submit to the the same page in which username is logged in.

    can i use `` but using it sends me to 404 page and i don’t want to use .htaccess.

    $username stands for and form code :-

    if(isset($_GET)) {
    $username = mysql_real_escape_string($_GET);
    if(ctype_alnum($username)) {
    //check user exists
    $check = mysql_query(“SELECT username,first_name FROM users WHERE username=’$username'”);
    if(mysql_num_rows($check)===1) {
    $get = mysql_fetch_assoc($check);
    $username = $get;
    $username = $get;
    }
    else
    {
    echo ““;
    exit();
    }
    }
    }
    ?>
    what should i do please help as i want to direct to the same page in which user’s profile is.

    #136577
    __
    Participant

    You are assigning `$username` to two different values in a row (the first value will be overwritten).

    The `` tag you are writing is malformed.

    Instead of writing a `` redirect, it would be much better to use PHP’s [`header()`](http://php.net/header) function.

    *****
    I can give you an example if you let me know what URL you want to redirect to.

    #136658
    donpeppo
    Member

    i recommend you to use PDO and prepared statements instead of mysql.
    its safer and mysql_* functions will be deprecated.

    http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/

    I know its not the answer to your question but i still think it will help you:)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.