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..  :-\

Link to comment
Share on other sites

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'];

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.