B2B sessions auslesen

D2587

Mitglied
HAllo Forummitglieder,
wie kann ich auf b2b sessions auf den schritt1.php und schritt2.php zugreifen?
URL-Beispiel Seite 1: schritt1.php?b2b=Nummer


schritt1.php
Code:
<?session_start();
$required = array();
$error_comment = array();
$error_count = 0;
function validEmail($email) {
			@ list($local, $domain) = explode("@", @ $email);
			$pattern_local = '^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?)\.([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$';
			$pattern_domain = '^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?)\.([-]?)[0-9a-z]*([-]?[0-9a-z]+)+)*\.[a-z]{2,4}$';
			$match_local = eregi($pattern_local, $local);
			$match_domain = eregi($pattern_domain, $domain);
			if ($match_local && $match_domain)
			    return true;
			return false;
}

//echo "<pre>";print_r($_POST); echo "</pre>";

if(@$_GET['b2b']!='')$_POST['b2b']=$_GET['b2b'];
if(count(@$_SESSION['schritt1'])>1 AND @$_POST['post_schritt1']=='')$_POST=$_SESSION['schritt1'];
if (@ $_POST['post_schritt1']) {
// process data


            if($error_count<1) {
                unset($_POST['post_schritt1']);
                $_SESSION['schritt1'] = $_POST;
                echo "<script>location.href='schritt2.php'</script>";
            }
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Anmeldeformular - Schritt 1</title>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />


</head>

<body>








<table border="0" cellpadding="3" cellspacing="2" id="whole_form">
  <tr>
    <td rowspan="2" id="anfrage">
        <div class="formular_content">

        <input type="hidden" name='b2b' value='<?echo @ $_POST['b2b'] ?>'/>
            <table class="formular" border="0" cellpadding="1" cellspacing="1">
                <tr> <form action="schritt1.php" method="post">
                    <input type="hidden" name='b2b' value='<?echo @ $_POST['b2b'] ?>'/>
                      <td colspan="2" class="formular_name_feld">
                      <span class="formular_name">Agenturanforderungen</span>
                      <?if (count($error_comment) > 0) {?>
                      <div class="error_div">
                  		<?
                  		foreach ($error_comment as $key => $item) {
                  					echo $item;
                  					echo "<br>";
                  		}
                  		?>
                      </div>
                      <?}?>
                      </td>
                </tr>
                <tr>
                    <td class="feld_name">Wir suchen eine Agentur f&uuml;r:</td>

                    <td class="feld">
                        <input type="checkbox" name='agentur_fur1'  <?if( @ $_POST['agentur_fur1']=='on') echo "checked" ?> <?if (@ $required['agentur_fur1'] != '') {?>class='error'<?}?>/> Ein Projekt<br />
                        <input type="checkbox" name='agentur_fur2' <?if( @ $_POST['agentur_fur2']=='on') echo "checked" ?> <?if (@ $required['agentur_fur2'] != '') {?>class='error'<?}?>/> Eine dauerhafte Betreuung / Zusammenarbeit
                    </td>
                </tr>
                <tr>
                    <td class="feld_name">Anzahl Mitarbeiter:</td>

                    <td class="feld">
                        <input type="checkbox" name='mitarbeiter_ohne' <?if(@$_POST['mitarbeiter_ohne']=='on')echo "checked" ?> <?if (@ $required['mitarbeiter_ohne'] != '') {?>class='error'<?}?>/> keine Einschr&auml;nkungen<br />
                        <input style="margin-left: 24px;" type="text" maxlength="2" name="mitarbeiter_min"  value='<?echo @ $_POST['mitarbeiter_min'] ?>' size="5"/><span style="margin-left: 7px;">mindestens</span><input style="margin-left: 24px;" type="text" size="5" maxlength="4" name="mitarbeiter_max"  value='<?echo @ $_POST['mitarbeiter_max'] ?>'/><span style="margin-left: 7px;">h&ouml;chstens</span>
                    </td>
                </tr>
                <tr>
                    <td class="feld_name">Agentur besteht seit:</td>

                    <td class="feld">
                        <input type="checkbox" name='besteht_ohne' <?if(@$_POST['besteht_ohne']=='on')echo "checked" ?> <?if (@ $required['besteht_ohne'] != '') {?>class='error'<?}?>/> keine Einschr&auml;nkungen<br />
                        <input style="margin-left: 24px;" type="text" maxlength="2" name="besteht_min"  value='<?echo @ $_POST['besteht_min'] ?>' size="5"/><span style="margin-left: 7px;">mindestens</span><input style="margin-left: 24px;" type="text" size="5" maxlength="4" name="besteht_max"  value='<?echo @ $_POST['besteht_max'] ?>'/><span style="margin-left: 7px;">h&ouml;chstens</span>
                    </td>
                </tr>
                <tr>
                    <td class="feld_name">Suchgebiet:</td>

                    <td class="feld">
                        <input type="radio" name="suchgebiet" value="ohne"  <?if (@$_POST['suchgebiet']=='ohne' OR @$_POST['suchgebiet']=='') echo "checked"?>  ><span style="margin-left: 7px;">Ohne Einschr&auml;nkungen</span><br />
                        <input type="radio" name="suchgebiet" value="bundesland"  <?if (@$_POST['suchgebiet']=='bundesland') echo "checked"?>  ><span style="margin-left: 7px;">Nur in meinem Bundesland</span><br />
                        <input type="radio" name="suchgebiet" value="plz"  <?if (@$_POST['suchgebiet']=='plz') echo "checked"?>  ><span style="margin-left: 7px;">Im PLZ-Bereich:</span><input style="margin-left: 15px;" type="text" name="plz" size=5 maxlength="5" value="<?echo @$_POST['plz']?>">
                    </td>
                </tr>


            </table>
            </div>
            <div class="formular_manage">

                            <table style="width: 100%">
                                <tr>
                                    <td class="zuruck"><!--<input type="button" class="zuruck_button"  name="zuruck" value="Zur&uuml;ck" onclick="location.href='schritt1.php'"/>--></td>
                                    <td class="schritt">
                                        <div class=progress_name>Fortschritt 25%</div>
                                        <div class="progress-bar">
                                            <div style="width: 25%;"/></div>
                                        </div>
                                    </td>
                                    <td class="weiter"><input type="Submit" class="weiter_button"  name="post_schritt1" value="Weiter"/></td>
                                </tr>
                            </table>

            </div>

    </td></form>
  </tr>
</table>
</body>
</html>

schritt2.php

Code:
<?session_start();
$required = array();
$error_comment = array();
$error_count = 0;

//echo "<pre>";print_r($_POST); echo "</pre>";
//echo "<pre>";print_r($_SESSION); echo "</pre>";

if(count(@$_SESSION['schritt2'])>1 AND @$_POST['post_schritt2']=='')$_POST=$_SESSION['schritt2'];
if (@ $_POST['post_schritt2']) {
// process data
            if ($_POST['anfrage_titel'] == '') {
						$required['anfrage_titel'] = 1;
						$error_count++;
			}
            if ($_POST['kontakt_bis'] == '') {
						$required['kontakt_bis'] = 1;
						$error_count++;
			}
            if ($_POST['beschreibung'] == '') {
						$required['beschreibung'] = 1;
						$error_count++;
			}
            if ($_POST['zeit'] == '') {
						$required['zeit'] = 1;
						$error_count++;
			}

            if($error_count<1) {
                unset($_POST['post_schritt2']);
                $_SESSION['schritt2'] = $_POST;
                echo "<script>location.href='schritt3.php'</script>";
            }
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Anmeldeformular - Schritt 2</title>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />


</head>

<body>
<script src="js/wz_tooltip.js" type="text/javascript"></script>
<table border="0" cellpadding="3" cellspacing="2" id="whole_form">
  <tr>
    <td rowspan="2" id="anfrage">
            <div class="formular_content">
            <table class="formular" border="0" cellpadding="1" cellspacing="1">
                <tr> <form action="schritt2.php" method="post">
                      <td colspan="2" class="formular_name_feld">
                      <span class="formular_name">Schritt 2. Ausschreibungsdetails</span>
                      <?if (count($error_comment) > 0) {?>
                      <div class="error_div">
                  		<?
                  		foreach ($error_comment as $key => $item) {
                  					echo $item;
                  					echo "<br>";
                  		}
                  		?>
                      </div>
                      <?}?>
                      </td>
                </tr>
                <tr>
                    <td class="feld_name">Titel:</td>

                    <td class="feld">
                        <input name="anfrage_titel" type="text" value="<?echo @$_POST['anfrage_titel']?>" <?if (@ $required['anfrage_titel'] != '') {?>class='error'<?}?>/><span class="question"><a onmouseover="Tip('z.b. Internetauftritt f&uuml;r<br />Elektrogro&szlig;handel', FADEIN, 400, FADEOUT, 400)"  onmouseout="UnTip()">?</a></span>
                    </td>
                </tr>
                <tr>
                    <td class="feld_name">Kontakt bis:</td>

                    <td class="feld">
                         <input name="kontakt_bis" type="text" value="<?echo @$_POST['kontakt_bis']?>" <?if (@ $required['kontakt_bis'] != '') {?>class='error'<?}?>/><span class="question"><a onmouseover="Tip('z.B. 18.08.2007<br />Dieses Datum bezeichnet den Zeitpunkt, bis zu dem die Agenturen Kontakt mit Ihnen aufnehmen sollen.', WIDTH, 200, FADEIN, 400, FADEOUT, 400)"  onmouseout="UnTip()">?</a></span>
                    </td>
                </tr>
                <tr>
                    <td class="feld_name">Ungef&auml;hre Zeitvorgabe:</td>

                    <td class="feld">
                        <input name="zeit" type="text" value="<?echo @$_POST['zeit']?>" <?if (@ $required['zeit'] != '') {?>class='error'<?}?>/><span class="question"><a onmouseover="Tip('z.B. ab Oktober 2007<br />Datuml.', WIDTH, 200, FADEIN, 400, FADEOUT, 400)"  onmouseout="UnTip()">?</a></span>
                    </td>
                </tr>
            </table>
            </div>
            <div class="formular_manage">
                        <table style="width: 100%">
                            <tr>
                                <td class="zuruck"><input type="button" class="zuruck_button"  name="zuruck" value="Zur&uuml;ck" onclick="location.href='schritt1.php'"/></td>
                                <td class="schritt">
                                    <div class=progress_name>Fortschritt 50%</div>
                                    <div class="progress-bar">
                                        <div style="width: 50%;"/></div>
                                    </div>
                                </td>
                                <td class="weiter"><input type="Submit" class="weiter_button"  name="post_schritt2" value="Weiter"/></td>
                            </tr>
                        </table>
            </div>

    </td></form>
  </tr>
</table>
</body>
</html>

Leider mit der Kode klappt es nicht:
<?php print $_SESSION['B2B']; ?>

Wie muss richtig geschriben werden?
 
Zurück