473,671 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

undefined index error

20 New Member
This is going to sound really stupid, but I cannot figure out why I am getting this error.

Expand|Select|Wrap|Line Numbers
  1. Undefined index: bil in C:\wamp\www\FORM\deleteadmin.php on line 4
  2.  
  3. Undefined index: adminID in C:\wamp\www\FORM\deleteadmin.php on line 5

line 4 and 5 looks like this,

Expand|Select|Wrap|Line Numbers
  1. $bil = $_POST['bil'];
  2. $adminID = $_POST['adminID'];
the full code are new.php which links to the deleteadmin.php that contains the error.

new.php
Expand|Select|Wrap|Line Numbers
  1. echo "<form name='update $bil' method=post action=newuser.php>" ?>
  2.     <tr>
  3.         <td><center><?php echo $bil; ?></center></td>
  4.         <td><?php echo $row['name']; ?></td>
  5.         <td><?php echo $row['tel']; ?></td>
  6.         <td><?php echo $row['email']; ?></td>
  7.         <td><?php echo $row['username']; ?></td>
  8.         <td><?php echo $row['password']; ?></td>
  9.         <td><a href = "deleteadmin.php"><img src="img/deleteicon.png" align="center"></a></td>
  10.         <input type=hidden value={$row['adminID']} name=adminID>
  11.         <input type=hidden value=$bil name=bil>
  12.     </tr>
  13. <?php 
  14.     echo "</form>";
  15. }
  16. ?>

deleteadmin.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include ('config.php');
  3.  
  4. $bil = $_POST['bil'];
  5. $adminID = $_POST['adminID'];
  6.  
  7. $result = mysql_query("DELETE FROM `admin` WHERE `adminID`= '$adminID'") or die (mysql_error());
  8.  
  9. if($result)
  10. {
  11. ?>
  12. <script language="javascript">
  13. alert("User No : <?php echo "$bil"; ?> DELETED");
  14. location.href="new.php";
  15. </script>
  16.  
  17. <?php
  18. }
  19. else
  20. {
  21. ?>
  22.  
  23. <script language="javascript">
  24. alert("User No : <?php echo "$bil"; ?> NOT DELETED");
  25. location.href="new.php";
  26. </script>
  27. <?php
  28. }
  29. ?>
What do I need to do to fix them?
I don't understand why this is happening, and I'd love to know how to make it go away.
Apr 1 '14 #1
5 1309
Dormilich
8,658 Recognized Expert Moderator Expert
the problem is that you have a link and not a submit button. you can simply combine button and image like:

Expand|Select|Wrap|Line Numbers
  1. <button type="submit">
  2.     <img src="…">
  3. </button>
Apr 1 '14 #2
leesyaa
20 New Member
I figured this do the trick!

Expand|Select|Wrap|Line Numbers
  1. <td><a href = "deleteadmin.php?adminID=<?php echo $row['adminID']; ?>&bil=<?php echo $bil; ?>"><img src="img/deleteicon.png" align="center"></a></td>
Apr 2 '14 #3
Dormilich
8,658 Recognized Expert Moderator Expert
well, if you‘re fine with using GET instead of POST … (and the fact that GET requests get cached)
Apr 2 '14 #4
leesyaa
20 New Member
less secure? hmm maybe this :D

Expand|Select|Wrap|Line Numbers
  1. $sql = "DELETE FROM admin WHERE md5(adminID)= '".md5($adminID)."'";
Apr 2 '14 #5
Dormilich
8,658 Recognized Expert Moderator Expert
that doesn‘t change the fact that both values are plainly visible on transmission. when they are on your server, they have reached the "secure" spot.
Apr 2 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1777
by: shalini11 | last post by:
Hello, I am using a page that has a dropdown list. when the user selects an item from the list and click on submit button, it opens a new page and displays the selected item. I've used as method in my form. and request to retrieve the selected value: <form method="POST" name="frmcriteria" action="test.php" target="_blank" onsubmit="return check(this)"> To retrieve: $model=$_REQUEST; It works fine. But i included a frame tht displays...
6
20847
by: jsgoodrich | last post by:
I am looking for some help if anyone can lend a hand. I have a simple php website that displays a table from my mysql database. To prep for my MCSE I moved my home server to Windows 2003 Standard, I installed mysql and php 5 to run some of my databases and websites. Under Linux the site worked fine, under windows I keep getting Notice Undefined Index error on line 67
7
2529
by: Philth | last post by:
Hey there, it has to be said that I am a complete novice in PHP, I know this is a common error and has probably been covered to some degree already - but my head really does hurt - so I couldn't stand trawling through anymore forums hunting for the right answer. Anyway - here goes. The page I'm having trouble with is a simple edit row type form, which brings up the specific row content specified by the id(albumNumber) passed from the...
1
1621
by: jason1987 | last post by:
I keep getting the undefined index error on the bottom two rows of my code simparent and equtype - the other two work fine yet there is no difference in my code. equtypeid is even from the same table as the top two $equid=$HTTP_POST_VARS; $fromuserid=$HTTP_POST_VARS; $simparent=$HTTP_POST_VARS; $equtype=$HTTP_POST_VARS; these are then used in an if statement
6
1636
by: nadomt | last post by:
Happy friday to all! I am getting the below error when visiting my user filter page. i have gone to line 68, but cant see what the problem is...can anyone assist? advanced THANK YOU! Error: E_NOTICE URL: http://mysite.com/admin/users_filter.php File: /home1/mysite/public_html/admin/users_filter.php Line: 68
3
3321
by: furqi | last post by:
hi i am actually having problem in this code i am trying to check the value in the if condition in the very last lines of the code but i am facing an error of "undefined index" can anybody tell me so that i can solve my problem. <html> <body> <form method="GET" action="switchcases.php"> <input type='text' name='furqan' > <?php $NAME=$_GET; switch($NAME)
0
896
by: Antonio Bacasno | last post by:
Please help me, I keep getting "Undefined Index Error". I'm also a noob in PHP. I can't echo back my equipcode and adddata, though I can successfully echo back curloc. Curloc and equipcode are basically the same codes. The others are working fine. Following are links to my codes (text-based): https://docs.google.com/leaf?id=0BwK6R2b_C7niNzM3ZmRlYTUtOGE2Yy00ZTlmLTk0YmYtNGU3MjQwMDRmZTNm&hl=en_US ...
0
1618
by: Antonio Bacasno | last post by:
I'm creating a page where I will create an account for authorized users. But I always get into this Undefined Index error. There are only two variables, but I can't seem to find what is wrong? Could someone please check my code and see what is wrong? I've also linked some images. Sorry for my noobiness. http://i729.photobucket.com/albums/ww293/AN2N10/CreateUser.jpg http://i729.photobucket.com/albums/ww293/AN2N10/UndefinedIndexError.jpg ...
1
1681
by: umarsulur | last post by:
Undefined index for the last element of array while fetching datas from db through an array variable. I use for each loop to seperate and also in_array()...kindly help pls..... Here is the code...... <?php include("includes/global_inc.php");
2
2527
by: yateesh | last post by:
This is the code to display the details (postfunction.php) <?php // Connection data (server_address, database, username, password) $dbhost = 'localhost'; $dbname = 'posting'; $dbuser = 'root'; $dbpass = '';
0
8820
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7433
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6223
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5695
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4224
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.