So, here I am again with another Problem -.-'
I programmed my own php/html script to give in and pass data from a form to a database. At the beginning it worked. Somehow, some days later it started redirecting me to the XAMPP localhost homepage (http://localhost/xampp/). I've got no idea why :/
Here's how my website looks like:
Here's how my "addguestbook.php" looks like:
<?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>
in index.php:
$get = "?mod=home";
This script is used for several stuff: overall gueastbook of the page and for comments on single posts & pictures/albums.
PS: i couldN't write hello at the beginning of the thread, for some reason :/ If that came over rude, i'm sorry!
PSS: Got the error.
Pretty dumb :)
I simply forgot that the forum is actually redirecting to (in this case) index.php in the root-directory. That means to Xampp/htdocs/index.php.
I just gotta fix the link and I'm fine -.-'
Just edit or delete the orginal index.html and remove the following line
<meta http-equiv="refresh" content="0;url=/xampp/">
Best would be if you also clean your cache, because the your browser is forecd to load everyting new.
endo
EDIT: Youre not alone with that problem: why-does-my-xampp-installation-auto-redirect-to-http-localhost-xampp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With