Jump to content

JJohnsenDK

Members
  • Posts

    400
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JJohnsenDK's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. i see where are going with this, but its not the problem, because i declare ohter sessions with there are no problem with. Im gonna post the code: $_SESSION['area'] echos just fine when i click first 'submit_area' button, but when i click 'submit_aktivitet' button i cant echo anymore, but then i can echo $_SESSION['aktivitet']. And again if i click the last submit (which brings me to a new page) i cant echo $_SESSION['aktivetet'] nor $_SESSION['area'] ?? <?php if(isset($_GET['y'])){ $year = $_GET['y']; }else{ $year = date('Y'); } if(isset($_GET['m'])){ $month = $_GET['m']; }else{ $month = date('n'); } if(isset($_GET['d'])){ $day = $_GET['d']; }else{ $day = date('j'); } if(isset($_POST['submit_area'])){ $_SESSION['area'] = $_POST['area']; } if(isset($_POST['submit_aktivitet'])){ $_SESSION['aktivitet'] = $_POST['aktivitet']; } echo "area: ".$_SESSION['area']."<br />".$_SESSION['aktivitet']; // Sessions $_SESSION['day'] = $day; $_SESSION['month'] = $month; $_SESSION['year'] = $year; // Date variables $today = date('j'); $daysInMonth = date("t",mktime(0,0,0,$month,1,$year)); $firstDay = date("w", mktime(0,0,0,$month,1,$year)); $dayOfWeek = date("N", mktime(0,0,0,$month,$day,$year)); $weeksInMonth = 6; echo $day."/".$month."-".$year." - ".$daysInMonth." - ".$firstDay." - ".$weeksInMonth." - ".$dayOfWeek; echo "<div style=' margin-left: 20px;color: white'>"; echo "<div style='width: 400px; margin-top: 30px;'>"; if(isset($_SESSION['area'])){ echo " <div style='float:right; width: 200px;'> <form method='post'> <select name='aktivitet'> <option value=0>Valg af aktivitet</option>"; $aktivitetQuery = dbquery("SELECT name, id FROM aktiviteter_kategori WHERE areas_id = '".$_SESSION['area']."'"); while($aktivitetData = dbarray($aktivitetQuery)){ echo "<option value=".$aktivitetData['id'].">".$aktivitetData['name']."</option>"; } echo " </select> <input type='submit' name='submit_aktivitet' value='Vælg' /> </form> </div>"; } echo " <div style='width: 200px;'> <form method='post'> <select name='area'> <option value=0>Valg af område</option>"; $areaQuery = dbquery("SELECT name, id FROM areas"); while($areaData = dbarray($areaQuery)){ echo "<option value=".$areaData['id'].">".$areaData['name']."</option>"; } echo " </select> <input type='submit' name='submit_area' value='Vælg' /> </form> </div>"; echo "</div>"; if(isset($_SESSION['aktivitet'])){ echo "<div style='width: 350px; margin-top: 30px;'>"; echo " <div style='float:right; width: 150px;'> <form method='post' action='index.php?site=booking_informationer'> <span style='font-weight: bold;'>Antal person:</span> <input type='text' name='persons' style='width: 30px' /> </div>"; echo " <div width: 150px;'> <select name='disciplin'> <option value='0' selected=\"selected\">Valg af disciplin</option>"; $disciplinsQuery = dbquery("SELECT name, id FROM disciplins WHERE aktiviteter_kategori_id = '".$_SESSION['aktivitet']."'"); while($disciplinsData = dbarray($disciplinsQuery)){ echo "<option value=".$disciplinsData['id'].">".$disciplinsData['name']."</option>"; } echo " </select> </div>"; echo "</div>"; echo "<div style='margin-top: 40px;'>"; if(isset($_GET['show'])){ echo "<div style='float: right; width: 450px; border: 1px solid white;'>"; echo getBookings($day, $month, $year); echo "</div>"; } echo "<div>"; echo "<table style='background-color: #5B5A56; color: black;'>"; echo "<tr><td colspan='8'><table style='background-color:#6F6F6F; color: white;'>"; echo "<tr style='font-size: 12px; font-weight: bold; text-align:center;'><td colspan='8'>".monthToString($month)." ".$year."</td></tr>"; echo "<tr><td>Uge</td><td>Man</td><td>Tirs</td><td>Ons</td><td>Tors</td><td>Fre</td><td>Lør</td><td>Søn</td></tr>"; echo "</table></td></tr>"; $calendar[][] = null; $days = 1; for($i=1; $i<$weeksInMonth; $i++){ // Skiftende række farve if($i % 2 == 0){ echo "<tr style='background-color: #EDEDED'>"; }else{ echo "<tr style='background-color: #FFFFFF'>"; } // Ugedage echo "<td style='background-color: white; color: #CBAD3D; border: 1px solid #6F6F6F; width: 20px; height: 20px;'>$i</td>"; for($d=1; $d<8; $d++){ if($days <= $daysInMonth){ if($days < $today){ echo "<td class='bookingBookedTD'>$days</td>"; }else{ if($i == 1 && $d < $firstDay){ echo "<td style='border: 1px solid #EDEDED; width: 20px; height: 20px;'></td>"; }else{ // Dato booket if(checkBookingDate($days, $month, $year)){ echo "<td class='bookingBookedTD'><a href='index.php?site=booking&d=".$days."&m=".$month."&y=".$year."&show=1'>$days</a></td>"; }else{ echo "<td class='bookingTD'><a href='index.php?site=booking&d=".$days."&m=".$month."&y=".$year."&show=1'>$days</a></td>"; } } } $days++; } } echo "</tr>"; } if($month == 12){ $nMonth = 1; $nYear = $year + 1; }else{ $nMonth = $month +1; $nYear = $year; } if($month == 1){ $pMonth = 12; $pYear = $year - 1; }else{ $pMonth = $month -1; $pYear = $year; } echo "<tr><td colspan='8'><table style='background-color:#6F6F6F; color: white;'>"; echo "<tr style='font-size: 12px; font-weight: bold; text-align:center; width: 100%;'><td style='width: 33%;'><a href='index.php?site=booking&m=".$pMonth."&y=".$pYear."'>Forrige</a></td><td style='width: 33%;'>Luk</td><td style='width: 33%;'><a href='index.php?site=booking&m=".$nMonth."&y=".$nYear."'>Næste</a></td></tr>"; echo "</table></td></tr>"; echo "</table>"; echo "</div>"; echo "<div>"; echo "<select name='hour'>"; for($i=getOpeningHours($dayOfWeek); $i <= getClosingHours($dayOfWeek); $i++){ if(checkBookingHour($i, $day, $month, $year, $_SESSION['aktivitet'])){ }else{ echo "<option value='$i'>$i</option>"; } } echo "</select>"; echo "<input type='submit' name='submit_booking' value='Næste' />"; echo "</form>"; echo "</div>"; echo "</div>"; } echo "</div>"; ?>
  2. How do i do that? Because i cant see what should make what i have made here, a more simple session page
  3. Hey When i make a $_SESSION['test']; should it "be alive" until i kill it with unset()? Because my code doesnt act that way. I have multiple form submits on my page and to remember the data from every form i use sessions. But the session only "survives" doing the one form submit. Here is some of the code: if(isset($_POST['submit_area'])){ $_SESSION['area'] = $_POST['area']; } if(isset($_POST['submit_aktivitet'])){ $_SESSION['aktivitet'] = $_POST['aktivitet']; } Here $_SESSION['area'] only lives when i have click the submit_area button. I have set session_start(); i top of the code. Whats wrong?
  4. Hey Im trying to check if a "(" char is in a string, but i get this error: Warning: preg_match() [function.preg-match]: No ending matching delimiter ')' found in C:\wamp\www\katrinelund\maincore.php on line 1218 What am i doing wrong? <?php if(preg_match("(", $str)){ do something }else do something else } ?>
  5. Hey Why doesnt this function return the result in $returnstr? I can echo the result inside the if statement, as you can see in the code. So where is the error? <?php function f($str){ $returnstr = "Resultat: "; if(findLastCharInString($str) == "("){ $returnstr .= substr($str, 0, -1); echo $returnstr."<br>"; }else{ echo $str."<br>"; f(substr($str, 0, -1)); } return $returnstr."222"; } $test = f("Mohair sokker sort (Large)"); echo "test: ".$test; ?>
  6. Hey Im having some problems with sending mails via my mailserver, or atleast i think it is my mail server that is the problem. I made this script: <?php $to = "test@mail.dk"; $subject = "Test af mail sendning"; $message = "Jaaah, dette er så en test."; $headers = "From: info@mail.dk"; echo "<h2>This sends mail to ".$to."</h2>"; if(mail($to, $subject, $message, $headers)){ echo "Send!"; }else{ echo "Could'nt send the mail "; } It returns Send! so the mail() function does its work, right? But i dont get any mail and i have also chekced my junk mail. I tried 3 different mail accounts, but notthing. What is wrong? Is it the mailserver which doesnt send the mail or?
  7. how do i check if one of those are installed? the webserver is running on a Zend Core installation.
  8. Im having problems sending mails from my webserver. I have tried to make a small php script which sends a simple mail: <?php $to = "test@msn.com"; $subject = "Test af mail sendning"; $message = "Jaaah, dette er så en test."; $headers = "From: test@toyou.com"; echo "<h2>This sends mail to ".$to."</h2>"; if(mail($to, $subject, $message, $headers)){ echo "Send!"; }else{ echo "Could'nt send the mail "; } ?> And it unfortunally shows: "Couldnt send the mail ". What could be wrong? Can i in any way test my webserver?
  9. also works for me... thanks alot mate!
  10. sry for late reply... preg_replace doesnt help me much here? how should this be better than str_replace?
  11. Hey How do i change letters in a string. And not just one letter. For example this string "Småbørn". Here are to none english letters which i want to change to english letters so i get: "Smaborn". How do i do this? $name = "Småbørn"; $len = strlen($name); $returnName = ""; for($i=0;$i<$len;$i++){ $letter = substr($name, $i, 1); echo "d"; if(strpos($letter, "å")){ $returnName .= str_replace("å", "a", $letter); }elseif(strpos($letter, "ø")){ $returnName .= str_replace("ø", "o", $letter); }elseif(strpos($letter, "å")){ $returnName .= str_replace("å", "a", $letter); }else{ $returnName .= $letter; } } echo $returnName; but it sucks. It doesnt work. Any ideas?
  12. aaah.... now i understand what you mean... its doesnt demand all that math, i might do with this solution, eventho i have to create alot of <div> manually... thanks to both of you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.