Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. Oops, I forgot the '?' that would indicate we're creating a get parameter. $link = "<a href=\"http://localhost/forum/forum.php?var={$_POST['somePostVar']}\">Delete</a>"; Of course for this to work there has to be a value inside of $_POST['somePostVar']. On the page in the link (forum.php in this case), to access the value you'd use: echo $_GET['var'];
  2. $q = mysql_query("SELECT COUNT(*) AS `Num` FROM ..."); $count = $q && ($row = mysql_fetch_assoc($q)) ? $row['Num'] : 0; echo $count;
  3. <?php $link = "<a href=\"http://www.home.com/delete={$_POST['somePostVar']}\">Delete</a>"; echo $link; ?>
  4. At the very least change your first query to: SELECT COUNT(*) AS `Num` FROM ... That way you aren't needlessly shuffling all that data around just to determine a record count.
  5. This is where a standardized set of update and insert functions comes in handy. Write the code once and then call it from anywhere.
  6. If you're checking it as it goes in, then theoretically you shouldn't have to check it as it comes out. If your database were directly compromised, as in someone were able to connect to it and insert whatever they wanted, then if you don't filter the data as it comes out it will affect your users. To what extent it harms them depends on what is placed in the database. I still wouldn't filter data as it came back out in most applications though. If you know for a fact that your code filters everything that goes in and somehow Javascript is coming back out, that's a pretty clear sign that something somewhere is insecure. Had you again filtered the output you would never know someone had direct access to your database.
  7. Looks good, hopefully they'll be happy with it. You might still want to provide text links for the menus in the flash in case someone has it disabled / not installed / or their ad-blocker hides it.
  8. No, you can't do that. PHP executes on the server before anything is sent to the browser. The timeout has to occur on the client. But I have to wonder if theres not a different way to solve your problem. It seems odd that the advertising script would mess up your layout. Are you sure you're using it correctly?
  9. You could add an event handler to the page's onload function. In the onload event handler, use the DOM to create a script element and set the appropriate .js url. I have no idea if that'd work though.
  10. In the interest of getting this solved: <?php $show = mysql_query("SELECT service.*,category.name FROM service LEFT JOIN category on service.category=category.id_cat WHERE category='$id'") or die(mysql_error()); echo "<table border=0><tr bgcolor='#D0DCE0'><th>Service</th><th>Description</th><th>Duration (minutes)</th><th>Prices</th></tr>"; while (($data = mysql_fetch_array($tampil)) && (mysql_num_rows($tampil) > 0)) { echo "<tr>"; echo "<td bgcolor='#D47FFF'>$data[name_serv]</td>"; echo "<td bgcolor='#FF55FF'>$data[desc_serv]</td>"; echo "<td bgcolor='#D47FFF'>$data[minutes]</td>"; echo "<td bgcolor='#FF55FF'>$data[price]</td>"; echo "<td><a href='' onclick='return disp_confirm()'>delete</a><br><a href=edit_service.php?id=$data[id_serv]>edit</a></td></tr>"; } echo "</table>"; }?> <script type="text/javascript"> function disp_confirm(){ var msg = "Do you really want to delete this?"; if (confirm(msg)){ window.location.href = "delete.php?id=<?php echo $datakategori['id_cat']; ?>"; } return false; } </script>
  11. It doesn't look to me like you're using the code I gave you. Your function function disp_confirm(){ var name=confirm("Benar2 mau dihapus?") if (name==true){ window.location.href = "delete.php?id=1"; } else{ return true; } } The one I gave you function disp_confirm(){ var msg = "Do you really want to delete this?"; if (confirm(msg)){ window.location.href = "delete.php?id=<?php echo $datakategori['id_cat'];?>"; } return false; } Your links <a href='' onclick='disp_confirm()'>delete</a> The links I gave you <a href='' onclick='return disp_confirm();'>delete</a>
  12. Nice layout. As someone who has been developing software for home builders for the past year and a half, trust me, don't take anymore as clients. They're not technologically minded and none of them know what they want.
  13. http://ajaxpatterns.org/Unique_URLs All I did was put window.location.hash into google.
  14. I've got several tables in a database that have a PRIMARY KEY assigned to a column as well as a UNIQUE or regular index on the same column. Am I right to assume that I can delete the UNIQUE and INDEX indexes on these columns and just keep the PRIMARY one?
  15. Perhaps I'm easily amused, or maybe cruel, but I just thought of a really fun Easter prank... Easter Egg Shaped Hermit Crab Shells! Think about all the fun and excitement when the little'uns pick up one of those!
  16. Try adding an expire time to the setcookie() call.
  17. Do you have a link to the page?
  18. http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  19. Not that I know of. If you change the address the browser will redirect automatically. You could make the page contained inside an iframe and change the src attribute of the iframe without affecting the URL displayed by the browser.
  20. date() http://www.php.net/date
  21. Perhaps change the target location to an absolute URL? I'm not sure why it wouldn't work at this point.
  22. The problem is that you're trying to set the $_GET parameter in the Javascript but you are not in PHP mode (because you've stepped out of PHP with the ?>). <script type="text/javascript"> function disp_confirm(){ var msg = "Do you really want to delete this?"; if (confirm(msg)){ window.location.href = "delete.php?id=<?php echo $datakategori['id_cat'];?>"; } return false; } </script>
  23. Is $datakategori[id_cat] a global PHP variable?
×
×
  • 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.