Jump to content

Dathremar

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by Dathremar

  1. I would suggest setting the name of the input to : <input type='checkbox' name='song[]' value='".$narray[$i]."'>".$narray[$i]."</input> So it would be an array when You submit it. Also when You get the variable on the other side $song_array = $_POST['song']; for ($i=0; $i < count($song_array); $i++) { // print out the xml }
  2. Thats should be Javascript problem not php. I know IE errors are not really useful but try to google them, there You can get the general idea about the error or if You can narrow it down post some code regards
  3. Use absolute path to the image ie: http://yourdomain/path/imagename.extension
  4. What op said or you could also use: $_REQUEST["variable_name"] which is substitute for both $_GET and $_POST
  5. It should be mysql_num_rows()
  6. <?php session_start(); include 'Utilitys/Connection.php'; include 'Utilitys/Functions.php'; if (isset($_POST['submit'])) { $role = "1"; $id = mt_rand(0, 9999999999); $time = date("F j, Y, g:i a"); $signup = date("F j, Y, g:i a"); $username = protect($_POST['Username']); $password = protect(md5($_POST['Password'])); $firstname = protect($_POST['FirstName']); $lastname = protect($_POST['LastName']); $email = protect($_POST['Email']); if (isset($role) && isset($id) && isset($time) && isset($signup) && isset($username) && isset($password) && isset($firstname) && isset($lastname) && isset($email)) { $save = "SELECT * FROM `users` WHERE username LIKE '$username'" or die (mysql_error()); $result = mysql_query($save); if (mysql_num_row($result) > 0) { $flag = "INSERT INTO `users` ('id', 'username', 'password', 'firstname', 'lastname', 'email', 'role', 'time', 'signup', 'gender') VALUES('$id', '$username', '$password', '$firstname', '$lastname', '$email', '$role', '$time', '$signup')" or die (mysql_error()); $run = mysql_query($flag); print "<p align='center'>Welcome $username,<br>You Have Now Been Register, Please <a href='Login.php'>Login</a><br>Many Thanks,<br>Admin.</p>"; } else { print "<p align='center'>Please Fill All Required Fields.</p>"; } } else { print "<p align='center'>Sorry But That Username ($username) Already Exist's, <br> Please Try Again.</p>"; } // another bracket missing } ?> Edited to put the code in php tags :/ There was 1 more missing bracket at the end
  7. Use tab to indent your code, so You know what chunk of code belongs where. It will make Your code much easier to read and to follow open and closed brackets.
  8. You are right, sorry. Didn't pay attention to that, I just copied his coded and change the part for echo of the variable. Was in a hurry and i neglected the code itself :S
  9. <?php // get posted data into local variables $mail = trim($_POST[mail]); if (trim($mail)=="") {exit("Please enter your E-Mail."); } else { echo "The E-Mail You Entered Is " . $_POST["mail"]. "!!"; } ?>
  10. Can You share some of the code? The redirect parts at least. Thx
  11. Read this preg_replace, You can count the replace made. You can use preg_match, for searching if the string contains illegal chars
  12. I would suggest for you to use javascript to check this. Here is a javascript function function Check_chars( data ) { var iChars = "!@#$%^&*()+=-[]\\\';,{}|\"<>?~_"; // Just put here what You want to be considered as invalid char for (var i = 0; i < data.length; i++) { if (iChars.indexOf(data.charAt(i)) != -1) { //alert ("Your string has special characters. \nThese are not allowed."); return false; } } return true; }
  13. This is what You are looking for http://www.php.net/manual/en/function.in-array.php
  14. <?php if (isset($select_var)) { switch($select_var) case 1: $var_array = array("blah1","blah2","blah3","blah4"); break; case 2: $var_array = array("foo1","foo2","foo3","foo4"); break; case 3: $var_array = array("nothing1","nothing2","nothing3","nothing4"); break; } // do what ever you want with $var_array ?> <select name='select_var'> <option value="var1">1</option> <option value="var2">2</option> <option value="var3">3</option> </select> Think this will help
  15. True that it is a lot of work, but if you want a drop down with images that's the way to do it.
  16. I wanted to do this, after a lot of googling I found some examples how it is made. The thing is like OP said this is not doable in a normal drop down. You will have to use CSS and javascript. So You will put all the options and the images into divs and then make them look like drop down list with css. Then add javascript functions for the onClick method, mouseover etc. GL making that P.S. I did't make it My contractor gave me too little time to play around
  17. For paging u need couple of things to keep in mind. Like number of all rows, rows presented on page. So when you execute the query set up a limit in the SQL. And transfer from 1 page to another the number of rows that needs to be displayed (if it is changable) and the last number of the last displayed row. Also You can find some really nice paging script on the web. Just use google a bit have fun
  18. Well the tables were for work in progress and not valid data in it. So renaming all indexes was kinda too much trouble and I thought that dropping the tables and recreating them (have sql queries from the program that i am creating the design) would be easier. I already dropped the whole db and recreated it from scratch Something that I thought was easier and faster ended up in loosing whole day in troubleshooting :S Ahh well I guess it happens. P.S. I think that the Fk on the other end matched the one i was creating. Think i checked that. But thanks anyway. Will keep that in mind for next time
  19. quotes problem use <input type='text' /> not <input type='text" /> - 2nd quote is double quote
  20. Try using the explode php function http://www.php.net/manual/en/function.explode.php That's how You can split the variable into array and they use them as u like Hope it helps
  21. Do what the OP said but plz dont put the $_GET variable directly into the sql Take the content of the $_GET variable and then check if contains the information that You want and then put it in the sql. Or even better just put some URL variable to determine what where statement to use for ex: 1 means "where bla = bla1" 2 means "where bla = bla2" etc So make a switch statement to determine which of the predefined sql to use. This is only for your own safty. Putting URl variables or anykind of variables directly into the sql can result sql injections. Hope I helped You P.S. I wrote this in a hurry so if u need more information please say so
  22. i will try to describe this as much as I can. So i have db with some tables which index names were not named as I wanted, so I decided to drop all the current tables and make them again with the new names for the indexes. Now after dropping the tables I try to create it again and I get error ERROR 1005: Can't create table './db/table.frm' (errno: 150), which is a foreign key constraint error. But how can this be ?!? I dropped the table and now i am creating it without any foreign key / index (gonna add them when i will finish adding the tables) and it still says that foreign key constraint fails. Which is more odd is that it is referring to an old table which also does not exist. ??? I am really confused. Have this happened to some1 else ? Have you solved the problem? Or this is some kind of db corruption that happened when i was droping and creating new tables? Thanks in advance
  23. Not sure what You trying to do. But If the question is how to partition large amount of data, then there are nice php paging scripts out there. Can't remember names now, but google it and You will find some
  24. If You are trying to access on different domain then the host of the script, I guess it is considered as cross site scripting and it is not allowed.
×
×
  • 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.