ERLEDIGT
NEIN
NEIN
ANTWORTEN
2
2
ZUGRIFFE
183
183
EMPFEHLEN
-
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 :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
<?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ü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ä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ö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ä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ö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ä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ü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 :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
<?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ür<br />Elektrogroß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ä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ü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>
Wie muss richtig geschriben werden?Leider mit der Kode klappt es nicht:
<?php print $_SESSION['B2B']; ?>
-
22.09.09 10:19 #2
Du musst die Session nochmals starten.
..:: MiNiMaG ::..
-
Ähnliche Themen
-
Sessions aus Tomcat auslesen
Von Johannes7146 im Forum Enterprise Java (JEE, J2EE, Spring & Co.)Antworten: 4Letzter Beitrag: 29.07.08, 12:30 -
Sessions auslesen - und in Radio-Buttons zur Überprüfung bereitstellen
Von altox-de im Forum PHPAntworten: 1Letzter Beitrag: 30.04.06, 18:39 -
Objekte aus SESSIONS auslesen?
Von sebastian423 im Forum PHPAntworten: 5Letzter Beitrag: 10.04.05, 22:48 -
Sessions auslesen
Von Caralynn im Forum PHPAntworten: 4Letzter Beitrag: 06.05.04, 16:30 -
Problem mit dem Auslesen der Sessions
Von MindCrawler im Forum PHPAntworten: 5Letzter Beitrag: 06.04.03, 12:28





Zitieren

Login






[PHP][Snippet] Array zu XML konvertieren