Jump to content

clausowitz

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Cairo

clausowitz's Achievements

Member

Member (2/5)

0

Reputation

  1. I show addresses on a webpage and want to show the locations on a small map. I have a javascript function for the maps using Google Api 3. The function is working but I have no idea to show it in my php-loop. Maybe it's not possible due to the difference in javascript and php. while($row = mysql_fetch_array($sql)) { $id = $row["id"]; $name = $row["name"]; $spec = $row["specialism"]; $address = $row["address"]; $telephone = $row["telephone"]; $lat = $row["lat"]; $lon = $row["lng"]; $loc = "$lat $lon"; if(($lat > '0') && ($lat > '0')) { } $outputList .= '<table cellspacing="0" bgcolor="#FFFFFF" border="0"><tr> <td colspan="2" class="boardHeader" style="padding-left: 6px;">' . $name . '</td> <td class="boardHeader" style="color:#3300CC; padding-left:6px; padding-right:2px; font-weight:bold" align="right">' . $spec . '</td> </tr> <td> </td> <td valign="left"> </td> <td rowspan="4"><div id="map_canvas-<?php echo $num2++; ?>" style="width:200px; height:150px">'; echo "javascript:GetMedicalMap($lat,$lon);"; $outputList .= '</div></td> </tr> <tr> <td style="padding-left: 6px;">Address:</td> <td colspan="1" style="vertical-align:middle" width="42%" >' . $address . ' </td> </tr> <tr> <td style="padding-left: 6px;">Telephone:</td> <td >' . $telephone . '</td> </tr> <tr> <td > </td> <td > </td> </tr><br /> '; } thanks for any advise, Marco
  2. OK, you mean all this has to go with AJAX? $short=$_POST['short']; $location=$_POST['location']; if(isset($_POST['type'])) { $type=$_POST['type']; } $starthour=$_POST['starthour']; $startmin=$_POST['startmin']; $endhour=$_POST['endhour']; $endmin=$_POST['endmin']; $reminders=$_POST['reminders']; $reminders=addslashes($reminders); if(isset($_POST['view'])) { $view=$_POST['view']; } if(isset($_POST['val'])) { $val=$_POST['val']; }
  3. I got it to work but not quiet. WHen I use following function: $(function() { $("form#form33").submit(function() { $("#dvloader").show(); $.post("editcalendar.php", function(data) { alert("Your event has been created, Close this window."); }); return false; }); I see the loading gif but the data doesn't get saved to the table. When I take out the "return false" to go back to the html The data gets saved but I don't see the loading gif. Also the loading gif gets displayed in the upper left corner of the form, even with this: #dvloader{ position:absolute; top:300; right:300; z-index:1; } What am I missing here (except knowledge of course)
  4. Sorry for being such an amateur. What I basically do is load a page called editcalendar.php. The users fills in an event with date and all and hits Submit. The event is saved in the database and all users get an email. During this process I want the loading.gif displayed to make sure people don't click Submit again thinking nothings happening. When the process is done the loading.gif should dissapear and a text should show up saying: Your event has been created, Close this window. So if I use the $.post function I would use it like this: $.post("editcalendart.php", function(data) { alert("Your event has been created, Close this window."); });
  5. Don't think I know what that means exactly. My code saves an calendar event to the database and then sends emails to all users. What output will there be? You mean a text saying something like: your event has been saved, please close this page?
  6. I understand it is some <div> but the name block1 is not in my page. So I guess it should be somewhere to show the image in. If I understand correctly.
  7. So that means I don't need the onclick function on the submit button. But what is the $(".block1").load("editcalendar.php"?
  8. How would that work? you mean like this: <form id='form33' action='editcalendar.php?ID=$ID' method='post'> <script language="javascript" type="text/javascript"> function toggleDiv(divid){ if(document.getElementById(divid).style.display == 'none'){ document.getElementById(divid).style.display = 'block'; }else{ document.getElementById(divid).style.display = 'none'; } } </script>
  9. OK so far I get it but will I be able to use the $(".changepass").click(function() on a submit button?
  10. I worked a bit with the code you gave me so the email doesn't take that long. Still I would like to show a loading gif. I tried with AJAX but it doesn't show: <div style="display:none" id="dvloader"><img src="images/loading.gif" /></div> $(function() { $(".changepass").click(function() { $("#dvloader").show(); $(".block1").load("editcalendar.php", function(){ $("#dvloader").hide(); }); return false; }); }); don't know exactly where to put it.
  11. Oeeps, I should explain. I tried to put in an loading gif so people know the code is busy. Marco
  12. I tried the following, but still it doesn't show. I don't get it. <?PHP $show .= '<input type="submit" name="submit" id="submit" onclick="$("#loading").show();" value="submit"></form>'; $show .= '<div id="loading" align="center" style="display:none;"><img src="images/loading2.gif" alt="" />Loading!</div>'; ?>
  13. Hi All, not sure if this is a php Q but maybe someone has experience with this. I use a form for people to add an item to the bulletin board. Sometimes the loading of the page takes very long and people think it didn't work so they click reload and post the item twice. I thought of adding a loading.gif so people know they have to wait. Anyone know how and where to put that in? <?PHP if(isset($_POST['submit'])) { if ($_POST['type']<>"") { $poster_id = $_SESSION['id']; $ID=$_GET['ID']; $short=$_POST['short']; $location=$_POST['location']; if(isset($_POST['type'])) { $type=$_POST['type']; } $starthour=$_POST['starthour']; $startmin=$_POST['startmin']; $endhour=$_POST['endhour']; $endmin=$_POST['endmin']; $reminders=$_POST['reminders']; $reminders=addslashes($reminders); if(isset($_POST['view'])) { $view=$_POST['view']; } if(isset($_POST['val'])) { $val=$_POST['val']; } $sql = mysql_query("SELECT * from bl_calender where dateclass='$ID' AND viewable='1'"); $numrows = mysql_num_rows($sql); // if the event exists then we want to edit it if ($numrows > 0){ // only the owner can edit an event while($row = mysql_fetch_array($sql)){ if($row['poster_id'] == $logOptions_id || $account_type == 'c' ){ $editcal="update bl_calender set datecotent='$reminders', location='$location', type='$type', starthour='$starthour', startmin='$startmin', endhour='$endhour', endmin='$endmin', short='$short', viewable='$view' where dateclass='$ID'"; mysql_query($editcal) or die("Could not edit calendar"); $msgToUser = '<br /><br /><font color="#FF0000">Your event has been updated. Close this window.</font><p></p>'; include_once 'msgToUser2.php'; } else { // you are not the owner $msgToUser = '<br /><br /><font color="#FF0000">Sorry but only the owner can change the event details.<br> Close this window.</font><p></p>'; include_once 'msgToUser2.php'; } } } else { // it's a new event we want to add $createevent="Insert into bl_calender (poster_id, dateclass, starthour, startmin, endhour, endmin, location, type, short, datecotent, viewable ) values ('$poster_id', '$ID', '$starthour', '$startmin', '$endhour', '$endmin', '$location', '$type', '$short', '$reminders', '1')"; mysql_query($createevent) or die(mysql_error()); $sql2 = mysql_query("SELECT * FROM myMembers WHERE notification_calendar='1'"); // query the members who want an email $numrows = mysql_num_rows($sql2); if ($numrows > 0){ while($row = mysql_fetch_array($sql2)){ if($row['email'] =="") { $to = $row['email_work']; } else { $to = $row['email']; } $your_firstname = $row['firstname']; $your_lastname = $row['lastname']; // send an email to everyone who wants it $webmaster = "KAI-DEFAT@minbuza.nl"; $headers = "From: MAAC Webmaster<$webmaster>"; $subject = "A new message has been posted in the MAAC Calendar."; $message = "Hello $your_firstname $your_lastname, a new event has been posted in the MAAC Calendar.\n"; $message .= "Goto the MAAC website to get the details.\n"; $message .= "Click here to view the Calendar $dyn_www/Web_Intersect/calen.php\n"; // send email mail($to, $subject, $message, $headers); } } } $msgToUser = '<br /><br /><font color="#FF0000">Your event has been created, Close this window.</font><p></p>'; include_once 'msgToUser2.php'; } ?>
  14. I have a form where people have to fill in some fields and send an email. When there is an error the user has to go back to the form with: if (!isset($_POST['checkbox'])) { $msgToUser = '<br /><br /><font color="#FF0000">You did not add any recipients!<br><a href="javascript: history.go(-1)">Go Back</a></font>'; include_once 'msgToUser.php'; exit(); } I want to save the data that has been filled in the textarea so he doesn't have to type eveything again. I tried several options but the textarea keeps getting blank. <?php $message = isset($_POST['message']) ? $_POST['message'] : ''; $fhtml = "<p>Welcome <b>'$logOptions_username'</b> write your email here. <a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:toggleViewFlags('country_flags');\">Add Recipients</a> <br> </p><input type=hidden name=post value=yes><p> Subject:<br> <input type=text name=name size=100> </p> <p> Message:<br> <textarea name=message rows=10 cols=75>$message</textarea> </p> <p> <input type=submit name=submit value=\"Send\"> $sendMsg </p> "; echo $fhtml; ?> This code is apparently not working. Marco
×
×
  • 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.