Ich versuche mittels PopUp ein neues Fenster zu öffnen,
sobald dieses geöffnet ist möchte ich Daten, mittels $_GET in die Datenbank einfügen ( Über das GET wird nur ein string übergeben "answer=yes" oder "answer=no" )
Jedenfalls bräuchte ich einen kleinen Schubser in die richtige Richtung...
PHP-Code:
<?
// Funktionen //
function show_active_survey() {
$select = "SELECT * FROM survey_active WHERE active = '1' LIMIT 1";
$result = tep_db_query($select);
while($row = tep_db_fetch_array($result)) {
$s_id = $row['survey_id'];
}
return $s_id;
}
//
function show_customers_survey ($survey_id, $lang) {
echo '<script type="text/javascript">
function popup_en(){
var fenster = window.open("http://survey.makant-europe.de/index.php?sid='.$survey_id.'&lang='.$lang.'", "upload_window", "height=600,width=800,status=1");
fenster.opener = self;
fenster.focus();
}
</script>';
echo '<div style="margin-top:9px; border: 1px solid #ccc;" align="center">';
echo '<b>'.get_lang_text($_SESSION['languages_id']).'</b><br><br>';
echo '<a href="index.php?osCsid='.tep_session_id().'&answer=yes" onclick="popup_'.get_lang($_SESSION['languages_id']).'()">'.get_lang_text_status('1', $_SESSION['languages_id']).'</a> / <a href="index.php?osCsid='.tep_session_id().'&answer=no">'.get_lang_text_status('0', $_SESSION['languages_id']).'</a>';
echo '</div>';
return $output;
}
//
function write_into_database($survey_id, $customers_id, $status) {
if ($status == "yes")
{$output = "1"; }
elseif ($status == "no")
{$output = "0";}
return $output;
$result = "INSERT INTO `survey_customer_status` (`customers_id`, `survey_id`, `status`) VALUES ('".$customers_id."', '".$survey_id."', '".$output."')";
mysql_query($result);
}
//
function get_lang($lang)
{
if ($lang == 1)
{ $string = "en"; }
elseif ($lang == 2)
{ $string = "de"; }
elseif ($lang == 3)
{ $string = "pl"; }
elseif ($lang == 4)
{ $string = "fr"; }
return $string;
}
//
function get_lang_text($lang)
{
if ($lang == 1)
{ $string = "Would you like to participate in the latest poll?"; }
elseif ($lang == 2)
{ $string = "Möchten Sie an der aktuellen Umfrage teilnehmen?
\"Titel\""; }
elseif ($lang == 3)
{ $string = "Would you like to participate in the latest poll?
\"Title\""; }
elseif ($lang == 4)
{ $string = "Souhaitez-vous participer dans le dernier sondage?
\"Titre\""; }
return $string;
}
//
function get_lang_text_status ($status, $lang)
{
if ($lang == 1 && $status == 1)
{ $string = "Yes"; }
elseif ($lang == 1 && $status == 0)
{ $string = "No"; }
if ($lang == 2 && $status == 1)
{ $string = "Ja"; }
elseif ($lang == 2 && $status == 0)
{ $string = "Nein"; }
if ($lang == 3 && $status == 1)
{ $string = "Tak"; }
elseif ($lang == 3 && $status == 0)
{ $string = "Nie"; }
if ($lang == 4 && $status == 1)
{ $string = "Oui"; }
elseif ($lang == 4 && $status == 0)
{ $string = "Non"; }
return $string;
}
//
?>
<?php
require_once('includes/application_top.php');
if (!empty($_SESSION['customer_id'])) {
show_customers_survey (show_active_survey(), $_SESSION['languages_id']);
}
/*
var_dump(show_active_survey()) . "<br>" .
var_dump(show_customers_survey("86556")) . "<br>" .
var_dump(write_into_database("86556", $_SESSION['customer_id'], "yes")) . "<br>" .
var_dump(write_into_database("86556", $_SESSION['customer_id'], "no"));
*/
?>
Hoffe ihr versteht was ich meine...
Sobald auf den Link "YES" geklickt wird soll dieser mittels $_GET an write_into_database übergeben werden und eine 1 in die Datenbank eingetragen werden
Auf dem umgekehrten Weg sollte dies aber auch passieren.
Wird "NO" angeklickt wird eine 0 weiter gegeben...