This is the code to display the details (postfunction.ph p)
Theres a form in that page to submit the review .
When i submit the form it displays an error saying :Undefined index: pid in C:\wamp\www\New \signup\postfun c.php on line 25
Heres the form
Line 25 is : $query->execute(array( ':pid' => $_GET['pid'],));
I have used $_GET['pid'] because on my other page there are links . When i click on those , they get displayed in this page (postfunction.ph p) by getting the pid of those links .
What am i missing ?
Code:
<?php
// Connection data (server_address, database, username, password)
$dbhost = 'localhost';
$dbname = 'posting';
$dbuser = 'root';
$dbpass = '';
// Display message if successfully connect, otherwise retains and outputs the potential error
try {
$conn = new PDO("mysql:host=$dbhost; dbname=$dbname", $dbuser, $dbpass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
echo $e->getMessage();
}
try
{
$query = $conn->prepare("SELECT * FROM review WHERE pid = :pid");
$query->execute(array(':pid' => $_GET['pid'],));
}
catch (PDOException $e)
{
error_log($e->getMessage());
die($e->getMessage());
}
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
//Details..
}
$conn=null;
When i submit the form it displays an error saying :Undefined index: pid in C:\wamp\www\New \signup\postfun c.php on line 25
Heres the form
Code:
<form action="ins.php" method="post"> <input type="hidden" name="pid" value="<? . $row['pid'] . ?>" /> <input type="hidden" name="id" value="<? . $row['id'] . ?>" /> <input type="text" name="review" /> <input name="submit" type="submit" value="Submit"/> </form>
I have used $_GET['pid'] because on my other page there are links . When i click on those , they get displayed in this page (postfunction.ph p) by getting the pid of those links .
What am i missing ?
Comment