Hi,

So I'm creating a website for clients that have tons of different courses available, they have opted to not place any course outlines within the site and instead, make the interested party request it via a email.

Now, here is where my problem comes in, I would like to create just one script, that handles all the requests and the subject should just change.

E.g
Excel 2003 Level 1
Excel 2003 Level 2
Excel 2003 Level 3
Excel 2007 Level 1

When the user clicks on Excel 2003 Level 1, i would like a window to popup, with my default form,

<form action="req_out.php" method="post" name="form1" class="course_header style1 style2">
          Request  course outline          
        </form>        </td>
      </tr>
      <tr>
        <td width="12%" bgcolor="#04508E" class="content style1">Email Address :</td>
        <td width="17%" bgcolor="#04508E"><input name="email" type="text" class="content" id="email"></td>
        <td width="10%" bgcolor="#04508E"><span class="content style1">Company :</span></td>
        <td width="17%" bgcolor="#04508E"><input name="company" type="text" class="content" id="company"></td>
        <td width="7%" bgcolor="#04508E"><span class="content style1">Course :</span></td>

 <td width="17%" bgcolor="#04508E"><input name="course" type="text" class="content"></td> -- ?? with the course they just clicked on

I hope any of this made sense if not, please ask and i will try explain better.

I would appreciate any help at all.

Thanks alot.

Recommended Answers

All 3 Replies

Are you storing these courses in a table ?

Excel 2003 Level 1
Excel 2003 Level 2
Excel 2003 Level 3
Excel 2007 Level 1

If yes, then, just pass the id of the clicked course in the query string of the popup, query the table and fetch the relevant course. If the courses are hardcoded, then put the courses in a session array variable. For the hyperlink of courses, use the index of this array and pass it in the query string.
Simple example.

//test.php
<?php
session_start();
$courses = array();
$courses[]="course1";
$courses[]="course2";
$_SESSION['courses'] = $courses;
foreach($courses as $key => $courses_offered) {
	echo "<a href='popup.php?courseid=".$key."'>".$courses_offered."</a><br />";
}
?>

and this is popup.php

<?php
//popup.php
session_start();
$courseid = $_REQUEST['courseid'];
$courses = $_SESSION['courses'];
echo $courses[$courseid];
?>

This is just a simple example to show how you can do it..

Thanks Nav,

I kinda get what you saying, let me give it a bash see how far I can get.

Cool !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.