Problema cu header redirect in php
Scris: Sâm Iul 31, 2010
am aceste trei pagini .. incerc sa fac o pagina de postat si de redirectionat automat catre pagina in care pot vizualiza datele introduse extragand din baza de date nr-ul .id...
dar cand postez imi arata link-ul : http:// www .domeniu.com/film.php?id= .. .si nu vrea sa extraga "id" din baza de date
addvideo.php :
insert_video.php
film.php
auzisem ca ceva din header nu e bine scris .. ma puteti ajuta ?
dar cand postez imi arata link-ul : http:// www .domeniu.com/film.php?id= .. .si nu vrea sa extraga "id" din baza de date
addvideo.php :
Cod: Selectaţi tot
<form action="insert_video.php" method="post">
<tr><td>Video Title:</td><td>
<input type="text" name="video_title"></td></tr> <br>
<tr><td>Continut:</td><td><br>
<textarea rows="7" name="video_continut" cols="30"></textarea></td></tr> <br>
<tr><td>Descriere:</td><td><br>
<textarea rows="10" name="video_details" cols="40"></textarea></td></tr> <br>
<tr><td colspan="2" align="right">
<center><input type="reset" name="reset" value="Reset">
<input type="submit" name="submit" value="Adauga film" onClick="return verifica(this.form)"></center>
<tr><td colspan="2" align="left"><a href="main.php">Back to Main</a></td></tr>
</table>
</form>
Cod: Selectaţi tot
<?
if($_POST['video_title']!=null && $_POST['video_continut']!=null && $_POST['video_details']!=null){
$video_title=$_POST['video_title'];
$video_continut=$_POST['video_continut'];
$video_details=$_POST['video_details'];
$query="INSERT INTO `video` (`video_title`,`video_continut`,`video_details`) VALUES ('".$video_title."','".$video_continut."','".$video_details."')";
mysql_query($query) or die(mysql_error());
header('Location: film.php?id='.$row['id']);
}else{
header('Location: addvideo.php');
}
?>
Cod: Selectaţi tot
<?
/**
* Main.php
*
* This is an example of the main page of a website. Here
* users will be able to login. However, like on most sites
* the login form doesn't just have to be on the main page,
* but re-appear on subsequent pages, depending on whether
* the user has logged in or not.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 26, 2004
*/
include("include/session.php");
?>
<html>
<title>Jpmaster77's Login Script</title>
<body>
<table>
<tr><td>
<?
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
echo "<h1>Logged In</h1>";
echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] "
."[<a href=\"useredit.php\">Edit Account</a>] ";
if($session->isAdmin()){
echo "[<a href=\"admin/admin.php\">Admin Center</a>] ";
}
echo "[<a href=\"process.php\">Logout</a>]";
}
else{
}
?>
<h1>FILME</h1>
<?
if($_GET['id']!=null){
$sql="SELECT * FROM `video` WHERE id='".$_GET['id']."'";
$r=mysql_query($sql);
while($row = mysql_fetch_array($r)){
echo $row['video'];
}
}
else{
header('Location: addvideo.php');
}
?>
</td></tr>
</table>
</body>
</html>