Jump to content

How to pass all three php values from one window to another


geekisthenewsexy

Recommended Posts

hey guys,i'm back with a new prob..

i have an image here that when clicked using onclick, will open a window and sort of pass the php values to the window.

okay,it's confusing but perhaps this will help you understand. let me break it down.

this is what the image code looks like. i have placed this inside the php echo.

 

<img src="images/edit.png" alt="Edit rooms" width="16" height="16" onclick="window.open(\'edit.php?course='.$row['c_name'].'&year='.$row['year'].'&block='.$row['block'].'\',\'width=300, height=200, menubar=yes\')"/>

 

now my problem is i can't seem to get all three of the values, c_name,year and block to be posted on the window..

here's the code on edit.php:

<?php
include("dbcon.php");
$course = $_GET['c_name'];
$year = $_GET['year'];
$block = $_GET['block'];
?>
<html>
<body>
Course:<input type="text" name="course" value="<?php echo $course;?>"><br>
  Year:<input type="text" name="year" value="<?php echo $year;?>"><br>
Block:<input type="text" name="block" value="<?php echo $block;?>"><br>

</html>

 

i have already used $_GET as you can see but only year and block appear on the form. i get a notice saying that c_name is an undefined index. i am really confused and i don't know what the problem is. i hope you guys can help me..  :-\

Your PHP Echo is:

 

<img src="images/edit.png" alt="Edit rooms" width="16" height="16" onclick="window.open(\'edit.php?course='.$row['c_name'].'&year='.$row['year'].'&block='.$row['block'].'\',\'width=300, height=200, menubar=yes\')"/>

 

But your code looks for:

 

$course = $_GET['c_name'];

 

So change your echo from ?course= to ?c_name= or change your code to $course = $_GET['course'];

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.