Jump to content

ajoo

Members
  • Content Count

    739
  • Joined

  • Last visited

Everything posted by ajoo

  1. Hi ! Ok so I have tried the code again as well. Just to be doubly sure that I have not made a mistake. When I select the color Red from the drop down menu, I get this error message. ( ! ) Fatal error: Cannot use isset() on the result of a function call (you can use "null !== func()" instead) in D:\xampp\htdocs\xampp\MagicOnn\testers\dropdownaction.php on line 3. Thus I do not get message "I am selected" or the value of $_POST['myselect']. Fastsol are you getting the message as well as the value of myselect? Thanks all !
  2. Hi Ch0cu3r, Thanks for the reply. I'll remember to enclose the HTML attributes in quotes. Thanks. However this does not work. ( How I wished it would ). But so far as I have read this does not work and we have to use javascript and we have to use the onChange event, like I have done in dropdown.php. The rest ( envoking the value of myselect) in and after being redirected to dropdownaction.php , however is still a mystery to me. Thanks !!
  3. Hi, I upgraded my XAMPP to the version 1.8.3 (win32) recently. Apache failed to start and I got the following error Port 443 in use by ""D:\xampp\apache\bin\httpd.exe" -k runservice" with PID 1568! On checking this PID against the running processes I found that this was the service Apache 2.2 httpd.exe. This new version installed however is Apache2.4. So it seems that the old version is somehow conflicting with the new. How can I do so. I do not wish to change ports in config files. The last version worked seamlessly and this upgrade has caused this conflict. I do not wish to have a patchwork solution, instead I would like to remove the old httpd.exe from wherever I must and have the ports free for the new one. Thanks for any suggestions and help. Ajoo.
  4. Thanks Ch0cu3r, your suggestion resolved the problem. It's fine even on a reboot. Thanks loads !
  5. Thanks Ch0cu3r, I'll try this and revert soon. Thanks !
  6. Hi Ch0cu3r, yes you are right ofcourse but i don't want to just stop the current apache 2,2 httpd.exe service but i want to remove it permanently. Else every time I restart the machine the 2,2 httpd.exe service come on and prevents the latest apache from starting. So any ideas how I can remove the 2.2 version service permanently. Thanks !
  7. Hi I am trying to split a form as shown in this simple code. I tried what I thought should work but obviously it is not working. This submits the first part of the form but does not go to the second part of the form. So First name, Last names and Age are submitted but email and cell are not and it throws a undefined index warning for those. Can someone please take a look at this and suggest if what I am trying to do can be accomplished using PHP. Thanks <?php if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') { echo"<br> First Name = ".$_POST['fname']."<br>" ; echo"Last Name = ".$_POST['lname']."<br>" ; echo"Age = ".$_POST['age']."<br>" ; echo"Email = ".$_POST['email']."<br>" ; echo"Cell = ".$_POST['cell']."<br>" ; } ?> <html> <head> <title> WOW </title></head> <body> <table> <form id="form1" action = "splitform.php" method="post"> <th> TEST </th> <tr><td>First Name : </td> <td><Input type='text' name = 'fname'></td></tr> <tr><td>Last Name : </td> <td><Input type='text' name = 'lname'></td></tr> <tr><td>AGE : </td> <td><Input type='text' name = 'age'></td></tr> </form> <form id ="form1" action = "splitform.php" method="post"> <tr><td>Email : </td> <td><Input type='text' name = 'email'></td></tr> <tr><td>Cell: </td> <td><Input type='text' name = 'cell'></td></tr> </form> <tr><td><Input type="submit" name = "submit" value = "Submit" form = "form1"></tr></td> </table> </body> </html>
  8. ajoo

    Split a form on the same page

    Yes Thanks , I guess that was not required as correctly pointed by all of you. Thanks
  9. ajoo

    problem in completing the form.

    Hi Psycho & all. I have gone through the example but I don't understand it too well bcos I am not familiar with javascript or Jquery for that matter. Hence I wanted a PHP only solution. My problem has two parts. The first is to display a SUBMIT button centered below the form. The second is to ensure that that submit button is also a part of the form that contains the checked box buttons. Else how would the status of the checked boxes get POSTed on submit. If this cannot be achieved with PHP alone then please could you kindly integrate the jquery code into my example for me. Thanks !
  10. Hi ! I am created this form - well it's more of a view and less of a form since the form part is only the check-boxes column and the rest is the data displayed from a database. But now I want to have this submitted with a SUBMIT button centered beneath the form after I have checked the required check boxes. I am unable to find a way to do this maybe simple task. Please help, unclubbed.php <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $db = 'testdb'; // CHANGE THIS TO ANY EXISTING DB ON PHPMYADMIN OR CREATE THIS DB FIRST IN PHPMYADMIN // $fcon = mysqli_connect($dbhost, $dbuser, $dbpass, $db); if(!$fcon ) { die('Could not connect: ' . mysql_error()); } // echo 'Connected successfully'; /* /////////// UNCOMMENT TO CREATE A TABLE IN A DATABASE NAMED testdb THEN COMMENT BACK ///////////// $sql = "CREATE TABLE member( mid INT NOT NULL AUTO_INCREMENT, name VARCHAR(20) NOT NULL, reg_date Date NOT NULL, email VARCHAR(30) NOT NULL, cell INT NOT NULL, status VARCHAR(2) NOT NULL, primary key ( mid ))"; if (mysqli_query($fcon,$sql)) { echo "Table member created successfully"; } else { echo "Error creating table: " . mysqli_error($con); } $query = "Insert into member (name, reg_date, email, status) VALUES ('John','1980-08-12','john@123.com','9878954323','cc')"; mysqli_query($fcon, $query); $query = "Insert into member (name, reg_date, email, status) VALUES ('Bill','1988-03-21','bill@123.com','9878900123','cc')"; mysqli_query($fcon, $query); $query = "Insert into member (name, reg_date, email, status) VALUES ('Jack','1990-05-18','jack@123.com','9878912300','cc')"; mysqli_query($fcon, $query); */ $check = true; $query = "SELECT * from member"; $result = mysqli_query($fcon, $query); if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') { echo "<br> Member = ".$_POST['name']."<br>" ; echo "RegDate = ".$_POST['reg_date']."<br>" ; echo "Email = ".$_POST['email']."<br>" ; echo "Status = ".$_POST['status']."<br>" ; /// more code would go here once I have submitted the check box information successfully ///// } ?> <html> <head> <title> CLUB ADMIN </title></head> <body> <table> <?php echo "<table class = 'TFtable' border = 1 cellspacing =2 cellpadding = 5 >"; echo "<tr>"; echo "<th> S.No. </th>"; echo "<th> Member </th>"; echo "<th> Reg Date </th>"; echo "<th> Email </th>"; if($check == true) echo "<th> <Input type='checkbox' id='selecctall' /> All </th>"; else echo "<th> Status </th>"; echo "</tr>"; $cnt = 1; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $name = htmlspecialchars($row['name']); $reg_date = htmlspecialchars($row['reg_date']); $cell = htmlspecialchars($row['cell']); $email = htmlspecialchars($row['email']); $mid = htmlspecialchars($row['mid']); if($check == false) $status = htmlspecialchars($row['status']); echo "<tr>"; echo "<td>".$cnt++."</td>"; echo "<td>".$name."</td>"; echo "<td>".$reg_date. "</td>"; echo "<td>".$email. "</td>"; if($check == true) { echo "<form name = 'form1' action='unclubbed.php' method='post' > "; echo "<td align ='center'><Input type='hidden' name='mid' value=$mid> <Input class='checkbox1' type = 'checkbox' name='check[]' value='$mid'> </td>"; echo "</form>"; echo "</tr>"; } else echo "<td>".$status. "</td> </tr> "; } ?> </table> </body> </html> Thanks !
  11. ajoo

    problem in completing the form.

    Hey I am sorry. I did not intend to post this one here but did so by mistake. I am using only php here. But from your reply it seems that it came to the right place. Is there no way to do this using PHP ? If not, then can we use JQuery instead? Meanwhile I'll look at your reply. Thanks for that Psycho.
  12. Hi friends, Another security issue but this time its regarding outputting data from a DB to a browser. Please have a look at the code below which displays some output fetched from a DB and sends it to a browser. 1. If I just wish to display this output on a screen and not provide the user with any buttons or hyperlinks to interact with the information, would I still need to sanitize the output before echoing it to the screen ? 2. If I was to make at least one of the fields a hyperlink, so that I could then display some related information on another webpage, what security concerns would I need to address in my code? 3. If I was to add a button against each of these records, on each row, and then select some related information on another webpage after processing the button handler, what would be the security concerns that I should address for the code below. Thanks very much. <table> <tr> <th> S.No. </th> <th> Name </th> <th> Age </th> <th> City </th> <th> Cell </th> <th> Email</th> </tr> <?php $cnt = 1; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo "<tr>"; echo "<td>".$cnt++."</td>"; echo "<td>".$row['Name']. "</td>"; echo "<td>".$row['Age']. "</td>"; echo "<td>".$row['City']. "</td>"; echo "<td>".$row['Cell']. "</td>"; echo "<td>".$row['Email']. "</td>"; echo "</tr>"; } ?> </table>
  13. Thanks loads. I'll take the precautions. Thanks Jacques for that insight into character encoding. I'll read more on that.
  14. Hi ! Thanks for the reply. #1. The source of this information would be a Mysql database. But yes I will use htmlspecialchars(). #2. For the second case I mentioned the hyperlink because that is passed through the URL and I thought that that maybe be a cause of a security concerns which should be addressed. #3. Yes this would be just like the #2 as you have mentioned and for this I would need to validate the post data submitted. If there is anything that you would like to add to the first 2 cases. Thanks
  15. Thanks Barand, that worked great. It was also getting the null record which i managed to eliminate by adding to the end of the query "AND dues IS NOT NULL"; Now i'll check out the earlier reply from you ( some things work better in code) and get back with the results. You have been awesome help and guide. Thanks loads.
  16. Hi Barand, Thanks for this. I have to check it out yet cos you've used the earlier table. I have studied the code and got the drift though. Still I'll try it out and revert. Meanwhile I have another twist on the previous Query that you solved below: SELECT cv.day_id, cv.dues, cv.last_visit, cv.points FROM clubvisit cv WHERE last_visit > ( SELECT MAX(last_visit) FROM clubvisit --+ WHERE points <> | ( | find the SELECT points as lastpoints --+ | latest date FROM clubvisit | find points | that had a JOIN | value from | point value ( | the record that | not equal to SELECT MAX(last_visit) as last_visit --+ get | matches the | points value FROM clubvisit | latest | latest date in | found in the ) --+ date | the subquery by | latest record as latest USING (last_visit) --+ JOIN on the date --+ ) ) This works great. However what if the MAX(last_visit) had to check for and ensure that the dues on this day was not NULL. If the dues was NULL in the last row ( highest date)then this row had not to be considered in the rest of the query. So i tried to get the latest date as follows:- JOIN ( SELECT MAX(last_visit) as last_visit FROM (SELECT* FROM clubvisit as cv WHERE dues IS NOT NULL) ) as latest USING (last_visit); But this gave an error " #1248 - Every derived table must have its own alias" . even though "SELECT* FROM clubvisit as cv WHERE dues IS NOT NULL" gave me the subset i wanted. So i don;t know how to eliminate this error though I tried. I even tried to use this statement as the first statement in the query and then work with the alias but that gave an error too. So how do i get there now ? Just for clarity if the Table is as below : (1 , 900 , '2012-12-01' , 6), (2 , 700 , '2012-12-04' , 7), (3 , 600 , '2012-12-07' , 5), (4 , 600 , '2012-12-09' , 6), (5 , 600 , '2012-12-10' , 6), (6 , 600 , '2012-12-14' , 6), (7 , NULL, '2012-12-14' , NULL); Then the last_value has to be that of date 14-12-2012 or day_id = 7 and the desired table should be calculated with corresponding point value of 6. The output should be as before :- +--------+------+------------+--------+ | day_id | dues | last_visit | points | +--------+------+------------+--------+ | 4 | 600 | 2012-12-09 | 6 | | 5 | 600 | 2012-12-10 | 6 | | 6 | 600 | 2012-12-14 | 6 | +--------+------+------------+--------+ Thanks !
  17. MacGyver is right but Thanks none the less, gives me something else to check and read about.
  18. Hi barand, Thanks for this but i forgot to change the dues values when i changed the table order earlier. So it kind of changed the entire sense of what was needed. So I am just going to put the table back here corrected and which is as follows: Day_ID -- Dues --- Last_Visit --- Points. 1 --------- 900 -------- 1/12 -------- 9 2 --------- 600 -------- 4/12 -------- 6 3 --------- 400 -------- 7/12 -------- 4 4 --------- 500 -------- 9/12 -------- 5 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 11/12 ------- 6 7 --------- 600 -------- 13/12 ------- 6 8 --------- 500 -------- 15/12 ------- 5 9 --------- 500 -------- 19/12 ------- 5 Ok so here's the modified table and I have changed the dates to be unique ( I understood that here we should have a date and time format for multiple entries on the same day) just to keep it simple. So now I am looking for the latest value of dues (500) . Then we move back on dates and the next is also 500, so we want that and then we come to dues value of 600 on Day_ID 7. Here the dues have changed. But now I want to know for how many earlier days were the dues 600. So we move back and find that till Day_ID = 5 or till on 10/12 the dues were same and equal to the value 600. That's it. Those are all the values I want. So my output should be : 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 11/12 ------- 6 7 --------- 600 -------- 13/12 ------- 6 8 --------- 500 -------- 15/12 ------- 5 9 --------- 500 -------- 19/12 ------- 5 I have checked and rechecked the table. Its correct. Please guide how this may be achieve achieved. Thanks loads !
  19. Hi barand, thanks for the response and yes this data is different from the earlier. I think there is a small mistake in the data in TABLE A ( the one in the previous post) so here's the new table again - TABLE B Day_ID -- Dues --- Last_Visit --- Points. 1 --------- 900 -------- 1/12 -------- 6 2 --------- 700 -------- 4/12 -------- 7 3 --------- 400 -------- 7/12 -------- 4 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 500 -------- 10/12 ------- 5 7 --------- 600 -------- 14/12 ------- 6 8 --------- 500 -------- 14/12 ------- 5 ok so now I think its correct. Yes multiple dates are allowed. However I think that the dates got goofed in the sense that they should have followed order ( Ascending I mean.). Ok but your keen observation has led me to another few questions. 1. I would like to ask that in a system where a person;'s visits to the club are entered serially, is it possible for the table to store them in an un-ordered manner as in TABLE A. 2. Even if the system enters inputs these dates in order, is there any manner that the table may get jumbled on dates (again as in TABLE A). 3. How can the same output be achieved for both the tables. I think if you just do that for me for the earlier TABLE A, I'll try and do the simpler TABLE B one myself. Thanks very much.
  20. Hi Barand ( guru), I am here once again with another query that i wish to form from the same table clubvisits. The table of entries is as below. Day_ID -- Dues --- Last_Visit --- Points. 1 --------- 900 -------- 1/12 -------- 6 2 --------- 700 -------- 4/12 -------- 7 3 --------- 400 -------- 7/12 -------- 4 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 14/12 ------- 6 7 --------- 500 -------- 10/12 ------- 5 8 --------- 500 -------- 14/12 ------- 5 The last time you created a query which checked for last entry value of Dues and the found all the entries for which the dues were same. This time I wish to change that slightly so that it finds the latest dues value (500) and checks for all records with the same dues value as well as all the value of the next dues values. i.e. I want to make a query whose result would be 4 --------- 600 -------- 9/12 -------- 6 5 --------- 600 -------- 10/12 ------- 6 6 --------- 600 -------- 14/12 ------- 6 7 --------- 500 -------- 10/12 ------- 5 8 --------- 500 -------- 14/12 ------- 5. I am able to get 6 --------- 600 -------- 14/12 ------- 6 7 --------- 500 -------- 10/12 ------- 5 8 --------- 500 -------- 14/12 ------- 5. if i change " Where last visit > " to " Where last visit >= " but I am not able to get the rest of the entries for which the dues value = 600. Help sought. Thanks again !
  21. yes that's exactly correct. yes I don't want someone to go to secound.php from anywhere else except the hyperlink so i guess sessions is the best way to ensure it. Maybe You can suggest something else. Thanks
  22. yea hi ! ok so this one file is not an included file. It's a PHP file, say second.php which is invoked by a hyperlink on the main webpage index.php. Now i don't want to give a direct access to it so i asked if something similar like defining a constant and then checking for it in the second.php , once the hyperlink was pressed in index.php, could be used to prevent direct access to this file second.php. I am actually thinking of using sessions to prevent direct accesss to this one - (a hyperlink invoked file). Thanks.
  23. Hey thanks ! yes I am now trying and using the define to define a constant. However what about a file that I have to access using a href defined hyperlink? What's the way to prevent direct access to that file other than what you suggested of putting the files into a folder other than the root. Please suggest something. Thanks !
  24. hey Thanks ! but guess what I tried and got it too. SELECT count(last_visit) FROM clubvisit cv WHERE last_visit > ( SELECT MAX(last_visit) FROM clubvisit WHERE points <> ( SELECT points as lastpoints FROM clubvisit JOIN ( SELECT MAX(last_visit) as last_visit FROM clubvisit ) as latest USING (last_visit) ) ); So i was also trying it even after posting the query. Thanks loads cos I am learning too with your help.
×

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.