I'm trying to figure out how to pass form data collected from sql database to a new window. The idea is when the user click 'Rediger' (edit), that a new small window will open up with the current data and an input field for the user to change the data, and then hit the save button for the data to be written to the database. Then the window must close and the original page being updated with the new data. Is this possible? Can anyone please help me with this? Thank you.
Check out the page here: http://kristoff.it/onlinecoaching/coach/ Here is my code:
<?php
/*Template Name: coach*/
?>
<?php
session_start();
$coachId = $_SESSION['coachId'];
$fornavn = $_SESSION['fornavn'];
$efternavn = $_SESSION['efternavn'];
$titel = $_SESSION['titel'];
$beskrivKort = $_SESSION['beskrivKort'];
$tlf = $_SESSION['tlf'];
$email = $_SESSION['email'];
$skype = $_SESSION['skype'];
$messenger = $_SESSION['messenger'];
$session30 = $_SESSION['session30'];
$session60 = $_SESSION['session60'];
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset');?>">
<title>
<?php
global $page, $paged;
wp_title( '|', true, 'right' );
bloginfo( 'name' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s' ), max( $paged, $page ) );
?>
</title>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script('comment-reply'); ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div class="outerWrapper">
<div><img src="http://kristoff.it/onlinecoaching/wp-content/uploads/2013/05/logo.png" width="726" height="114" alt="OnlineCoaching"></div>
<div align="center">
<div class="contentForside">
<form method="POST" action="" id="submitcoach">
<?
$sql = "SELECT * FROM coach where coachId=1";
$result = mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
echo '<div class="coachgreen">';
echo '<h1>Velkommen coach ' . $row['fornavn'] . '</h1>';
echo '<div class="coachwhite">';
echo '<table border="0" align="left" width="99%">';
echo '<tr><td align="center" valign="top">';
echo '<table border="0" valign="top" width="130">';
echo '<tr><td><img id="coachImg" src="' . $row['imgUrl'] . '" width="110" height="120" alt="' . $row['imgAlt'] . '"></td></tr>';
echo '<tr><td valign="top"><p>Skift billede</p></td></tr>';
echo '<tr><td valign="top"> </td></tr>';
echo '<tr><td><img id="coachImg" src="http://kristoff.it/onlinecoaching/wp-content/uploads/2013/05/allanscherfig_video.jpg" width="110" height="120" alt="' . $row['imgAlt'] . '"></td></tr>';
echo '<tr><td valign="top"><p>Upload ny video</p>' . '</td></tr>';
echo '</table>';
echo '</td>';
echo '<td valign="top"><br>';
echo '<table width="100%" border="0">';
echo '<tr height="25">';
echo '<td valign="top"width="15%"><p id="coach"><b>Titel</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['titel'] . '</p></td>';
echo '<td><p id="coach">Rediger</p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Beskrivelse kort</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['beskrivKort'] . '</p></td>';
echo '<td valign="top"><p id="coach">Rediger</p></td>';
echo '</tr>';
echo '<tr height="110">';
echo '<td valign="top"><p id="coach"><b>Beskrivelse lang</b></p></td>';
echo '<td valign="bottom"><div id="beskrivLang"><p id="coach">' . $row['beskrivLang'] . '</p></div></td>';
echo '<td valign="top"><p id="coach">Rediger</p></td>';
echo '</tr>';
echo '<tr height="10"><td colspan="3"> </td></tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Brugernavn</b></p></td>';
echo '<td valign="top"><p id="coach">brugernavn</p></td>';
echo '<td valign="top"><p id="coach"> </p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Adgangskode</b></p></td>';
echo '<td valign="top"><p id="coach">Adgangskode</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Klient telefon</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['tlf'] . '</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="25">';
echo '<td valign="top"><p id="coach"><b>Skype</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['skype'] . '</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="22">';
echo '<td valign="top"><p id="coach"><b>Messenger</b></p></td>';
echo '<td valign="top"><p id="coach">' . $row['messenger'] . '</p></td>';
echo '<td valign="top"><p id="coach">Skift</p></td>';
echo '</tr>';
echo '<tr height="42">';
echo '<td align="right" valign="bottom"> </td>';
echo '<td valign="top"> </td>';
echo '<td valign="top"> </td>';
echo '</tr>';
echo '</table>';
echo '</td></tr>';
echo '</table';
}
?>
</form>
</div>
</div>
</div>
</div><!-- end contentForside -->
</div><!-- end center -->
</div> <!-- end outerWrapper -->
<div align="center">
<div class="copyright">
<?php echo 'copyright © ' . date('Y ') . '<a href="http://www.kristoff.it">kristoff.it</a>' ;?>
</div>
</div>
</body>
</html>