Jump to content

jaisol

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jaisol's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. try adding else { echo " username, password or both not found"; } so your if statement reads if ($username==$dbusername&&$password==$dbpassword) { echo "Successful login, welcome!"; } else { echo " username, password or both not found"; } at least you'll know if its even checking that if statement, the else bit is executed if the"if" is false, and you get either a welcome msg or a not found msg .
  2. On the server side if(isset($_GET['page_no_id'])) { $page_no = $_GET['page_no_id']; // do whatever code you want } On the web page you want <a href=\"test.php?page_no_id=page_no\">$page_no_id</a> test.php is the the file that contains the server side code. Thats for a hyperlink.After the "?" is the name of the $_GET['var_name'] the "=" is the value you want. for a submit button I think it works just the same as $_POST['] Try doing var_dump($_GET['your_var_name'])
  3. Many thanks Kicken & SergeiSS. I managed to solve it I just needed 2 foreach loops function save_selected() { if(isset($_POST['image_id'])) { $file_status = $_POST['image_id']; $index_key = key($file_status); foreach ($file_status as $index_key => $value) { $file_id = $index_key; $dog2 = $value; foreach ($dog2 as $index_key => $value) { Echo "<br>Index_key, foreach value = $file_id, $value"; // File_id gives me the file id and the $value gives me the save, delete, whatever bit. if($value =="save") ....... } } } } I like the use of the curly braces {}, and explode(). The problem I had was the $_post[image_id] var coming back was an array within an array and runing foreach once gave me the file id and "array" for the $value. It just needed running through twice and taking the first $value as the array for the second foreach. Many thanks
  4. This is the php code that is trying to read the $_post bit function save_selected() { if(isset($_POST['image_id'])) { $dog1 = $_POST['image_id']; // $dog2 = $_POST[] if (isset($dog1)) { var_dump($_POST['image_id']); // $dog = $_POST['image_id']; // echo "<br> dog 0 = " . $dog['1500'] . __LINE__ ; // echo "<br> dog 1 = " . $dog[1] . __LINE__ ; echo "<br> Key for dog 1 = " . key($dog1) . __LINE__; // var_dump($dog); // echo "<br> dog dump = " . var_dump($dog); // echo "<br> dog = " . $dog; while($element = current($dog1)) { echo "<br> Loop = " . key($dog1)."\n"; $index_key = key($dog1); foreach ($dog1 as $index_key => $value) { Echo "<br> foreach value = $value"; } next($dog1); } /* foreach ($dog as $value) { echo "<br> Value 0 = " . $value['0']; echo "<br> Value 1 = " . $value['1']; echo "<br> Value 2 = " . $value['2']; echo "<br> Value 3 = " . $value['3']; echo "<br> Value 4 = " . $value['4']; echo "<br> Value 5 = " . $value['5']; echo "<br> Value = " . $value; // var_dump($value); } foreach($dog as $key => $value) { echo "<br> Value key 0 = " . $value['0']; echo "<br> Value key 1 = " . $value['1']; echo "<br> Value key 2 = " . $value['2']; echo "<br> Value key 3 = " . $value['3']; echo "<br> Value key 4 = " . $value['4']; echo "<br> Value key 5 = " . $value['5']; echo "<br> Value key = " . $value; } */ } } //TODO }
  5. The $ sign is there but it was omited because I changed the var name in the msg from $dog1 to $file info to make it easier to read. You ask about "blocks" err which block do you mean? The web page form has upto 100 blocks of that code, its generated from a database and echoed back to the web page. Yes I could use option boxes for save and delete, and a tick box for rotate, and yes someone may want to save the file and rotate it at the same time. I just want to use 3 tick boxes and get the data back if they are ticked.
  6. the foreach bit $dog1 should read $file_info and not $dog1
  7. Hi What I need to do is retrieve information from a web form, that contains a file id, and which options from check boxes have been ticked. The code in the web form is. <td width=\"206\"><p>$filename1<br><img src=\"$filename1\" alt=\"$filename1\" /></p> <p> <label> <input type=\"checkbox\" name=\"image_id[$unique_id1][save]\" value=\"save\" id=\"CheckboxGroup1_1\" /> Save</label> <br /> <label> <input type=\"checkbox\" name=\"image_id[$unique_id1][delete]\" value=\"delete\" id=\"CheckboxGroup1_2\" /> Delete</label> <br><label> <input type=\"checkbox\" name=\"image_id[$unique_id1][rotate]\" value=\"rotate\" id=\"CheckboxGroup1_3\" /> Image needs rotating</label> <br /> </p></td> This returns the following when I do a var_dump of $_POST['image_id'][/code] when all three boxes are ticked. array(1) { [4600]=> array(3) { ["save"]=> string(4) "save" ["delete"]=> string(6) "delete" ["rotate"]=> string(6) "rotate" } } the format is as follows 4600 is the file ID, the 3 others are save, delete, and rotate It appears to work ok, but I can't get at the data easily I can get the key using key(), but I can't get the other bits of data out using a foreach loop. if(isset($_POST['image_id'])) { $file_info = $_POST['image_id']; if (isset($file_info)) { var_dump($_POST['image_id']); while($element = current(file_info)) { echo "<br> Loop = " . key($file_info)."\n"; $index_key = key($file_info); foreach ($dog1 as $index_key => $value) { Echo "<br> foreach value = $value"; } next($file_info); } } } I'm wondering if the array that is being sent back is ok as I tried to creat an array that sent back the same and couldn't, so maybe my code in the form needs changing.
  8. Many thanks 1st reply works for me. As I want to hide the image from a user that choses to 'delete' and not hide the image from every user. Thanks again
  9. I'm designing a photo gallery, with about 100 pictures per page. I want to store all image file names in a table called images (1 colum - file_name) I also want to store user details to show if they have deleted an image and not show that image when they redraw the page. I will call this table User_Deleted (2 colum - user_id, file_name) I'm thinking of doing something like $user_id = the current user Select * from user_deleted where user_id = $user_id retrive the file names and store into an array run a loop to add " AND file_name != next file name in the array and then parse it onto the end of a Select command Select * from images WHERE file_name != 1st deleted file AND file_name != 2nd deleted file AND .. however many files have been marked LIMIT 100 I'm sure there must be an easier way of doing it, but I'm not smart enough to see it LOL I think something like Select * from images but not if they are in Select * from user_deleted where user_id = $user_id would be a better way but I can't figure out how you write that sort of statement.
  10. Many thanks I'll count the rows to check my results, I wrongly thought if the query returned 0 rows then it would be unsucessful. I've learned otherwise .. LOL
  11. I have the following code its from a php function. $query3 = "SELECT * FROM `client` WHERE `c_fname` = 'brick' LIMIT 0, 2"; $dog = mysql_query($query3); echo "<br> query result {$dog}"; The above code returns a resource ID I was expecting it to return false as there is no "brick" in the colum c_fname. Anyone know why its returning a resource id?
×
×
  • 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.