Redirecionamentos HTML Formular to XAMPP localhost Home-Page

Então, aqui estou eu novamente com outro problema -.- '

Eu programei meu próprio script php / html para ceder e passar dados de um formulário para um banco de dados. No começo funcionou. De alguma forma, alguns dias depois, ele começou a me redirecionar para a página inicial do localhost do XAMPP (http: // localhost / xampp /). Não tenho ideia do porquê: /

Veja como meu site se parece:

  • index.php
    • todos os outros scripts (via Switch-case)
    • incluindo meus scripts de livro de visitas (sem switch-case!) Está sempre lá!

Veja como meu "addguestbook.php" se parece:

   <?php

...database stuff...

if ($_SERVER['REQUEST_METHOD'] == 'POST'){

    $name = $_POST['name'];
    $email = $_POST['email'];
    $website = $_POST['website'];
    $comment = $_POST['comment'];
    $datetime = date("l, jS M Y, g:i a"); //date time

    // Connect to server and select database.
    mysql_connect($host, $username, $password)or die("cannot connect server: ".mysql_error());
    mysql_select_db($db_name)or die("cannot select DB: ".mysql_error());

    $sql="INSERT INTO ".$tbl_name."(id, name, email, website, comment, datetime)VALUES('".$post_id."', '".$name."', '".$email."', '".$website."', '".$comment."', '".$datetime."')";
    $result=mysql_query($sql);

    mysql_close();

    header('Location: http://'.$hostname.$path.'/index.php' . $get, true, 303);
}?>

<form action="index.php<? echo $get; ?>" method="post">
    <table border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="guestbookFormCell" colspan='2'><input
                class="guestbookInputFieldText" name="name" type="text"
                value="Name *" size="40" maxlength="30" /></td>
        </tr>
        <tr>
            <td class="guestbookFormCell" colspan='2'><input
                class="guestbookInputFieldText" name="email" type="text"
                value="E-Mail (won't become displayed)" size="40" maxlength="40" />
            </td>
        </tr>
        <tr>
            <td class="guestbookFormCell" colspan='2'><input
                class="guestbookInputFieldText" name="website" type="text"
                value="Website" size="40" maxlength="50" /></td>
        </tr>
        <tr>
            <td class="guestbookFormCell" colspan='2'><textarea
                    class="guestbookInputFieldText" name="comment" cols="37" rows="5">Comment *</textarea>
            </td>
        </tr>
        <!-- 
        <tr>
            <td>CAPTCHA</td>
        </tr>
         -->
        <tr>
            <td><button class="guestbookFormCell guestbookButton" type="submit"
                    name="submit">
                    <span class='guestbookButtonText'>Send</span>
                </button></td>
            <td><button class="guestbookFormCell guestbookButton" style="float:right;"type="reset"
                    name="reset">
                    <span class='guestbookButtonText'>Reset</span>
                </button></td>
        </tr>
    </table>
</form>

no índice .php:

                $get = "?mod=home";

Este script é usado para várias coisas: guia geral da página e para comentários em postagens únicas e fotos / álbuns.

PS: Não consegui escrever olá no início do tópico, para alguns motivo: / Se isso foi rude, sinto muito!

PSS: Entendi o erro.

Muito idiota:)

Eu simplesmente esqueci que o fórum está redirecionando para (neste caso) índice. php no diretório raiz. Isso significa que Xampp / htdocs / index.php.

Só tenho que corrigir o link e estou bem -.- '

9
задан JustBasti 16 June 2011 в 13:02
поделиться