473,750 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Record Update

107 New Member
Hi Experts, here i come again and wanna ask how we can perform record update in PHP & MySQL without passing the id in the URL for the $_GET method to be used in the processing page. I mean I have records of tenders displayed in a page and each of the records are hyper linked to edit and delete links. And at present what i am doing is embedding id in the URL i.e
Expand|Select|Wrap|Line Numbers
  1. <a href=edittender.php?id=$id>Edit</a>
. Now, i dont want the id to be embedded in the URL and instead want any other methods to be applied to get this workdone. Can you all advice me how i can go about?
Feb 19 '09 #1
12 1830
Dormilich
8,658 Recognized Expert Moderator Expert
use the POST method, though this requires either form submission or AJAX procedures.

regards
Feb 19 '09 #2
raamay
107 New Member
thankyou but i am not sure how POST can be used in this situation. Can i have an example please?
Feb 19 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. <form action="edittender.php" method="post" accept-encoding="UTF-8">
  2.     <input type="hidden" name="id" value="id_to_submit">
  3.     <input type="submit" name="send" value="send request">
  4. </form>
Feb 19 '09 #4
raamay
107 New Member
sorry but i think you didnt understand me. well, i please see my code below:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $q= "SELECT * FROM ".TABLE." order by field";    
  3.  
  4. $result_ = $database->query($q_);
  5.  
  6. $num_rows_ = mysql_numrows($result_);
  7.  
  8. for($j=0; $j<$num_rows_; $j++) {                  
  9.      $id = mysql_result($result_,$j,"id");
  10.      $tender = mysql_result($result_,$j,"tender");
  11. ?>
  12. <table>
  13. <tr>
  14. <td><?php echo $tender; ?></td>
  15. <td><a href="edittender.php?id=$id">Edit</a>
  16. </tr>
  17. </table>
  18. <?php
  19. }
  20. ?>
  21.  
The code above can generate all records available in a table and each of it has a EDIT link. Now what i meant to say was that i dont want the id to be passed in the URL which i have done at present. In this case i can't use a form with buttion to pass the id for a POST method.
Feb 19 '09 #5
Markus
6,050 Recognized Expert Expert
- butts in.

Then your other option is AJAX. Although, I don't understand your issue with using GET.
Feb 19 '09 #6
Dormilich
8,658 Recognized Expert Moderator Expert
@raamay
why not?

does it matter if you use a button (form) or a link (href) to trigger the edit? I could have named the button EDIT to make that clearer (but I've had little time, so...)
Feb 19 '09 #7
TheServant
1,168 Recognized Expert Top Contributor
To submit forms without having to click a submit button your best bet as has been said twice is AJAX. PHP will do your server side stuff but if there is a problem on the client side (eg. submittting a form in a fancy way) you want to go javascript/AJAX.
Feb 19 '09 #8
Dormilich
8,658 Recognized Expert Moderator Expert
@TheServant
that's a rather complicated way of submitting a form.... and kind of spoils the intention a form.

the only thing is that you (normally) don't leave the page with AJAX, whereas a link will make you leave the page (so does a form).

but still I've not been told why a form is here impossible to use. I'd really like to know that.
Feb 20 '09 #9
Atli
5,058 Recognized Expert Expert
Hi.

What I am wondering is... what is the point of removing the ID from the URL?

Whether you pass it via the URL, a typical form using POST or AJAX, the result is the same.
And from a security standpoint, they are all pretty much equal. (Given that you designed the server-side portion properly.)
Feb 20 '09 #10

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

Similar topics

1
8791
by: Richard C Buchanan | last post by:
I have a table as follows: - user_id (key) - user_email_address (text) - user_request_date (text) - user_sent_date (time/date) An automated macro will run every 5 minutes and needs to run a SQL UPDATE that:
5
4334
by: Ilan Sebba | last post by:
When it comes to adding records in related tables, Access is really smart. But when I try to do the same using ADO, I am really stupid. Say I have two parent tables (eg Course, Student) and one child table (StudentProgress). The course progress records how a student progresses on a course. I have one course (History) and one student called Maya. I now want to record her grade (64). If I do this in Access using a form, then the form...
4
2205
by: James P. | last post by:
Hello there, I have a bound-form using Navigator so that the user can move back and forth to update record in the form. Every time a record was modified and the user clicks the Navigator to either move backward or forward to the next record, a message is popped up asking the user to confirm the change. If the user clicks "Yes", the record should be updated and the Navigator takes the user to the next record as clicked. If the user...
8
12103
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
7
2402
by: todholt | last post by:
Hello, I am trying to bypass a form's automatic update, and instead call a stored procedure in sql server. I am using continuous forms. The problem I am having is with returning to the next selected record once I have performed the update. i.e. user edits record A and then clicks on record B. Record A is updated, and selection moves to record B. I don't know how to determine what record B is...
3
15425
by: Mihaly | last post by:
I want to update a record into a table in SQL Server 2000 database from C#. This table is used concurently for other users too, and I want to be sure that from the read of record to the update no other user was updated the record. Please tell me how can I do this. Thank you!
3
2414
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent table. However I put some code in to display the key field of each parent table record (parent dataset) and the value I am trying to put into the child table is there. ParentTable ChildTable ID------------------------<...
3
2264
by: smugcool | last post by:
Hi, I have created a form in Visual basic 6.0 for adding/updating the change request made by various users. Well i am able to update the record through my code in access database. Can anyone tell me what code should i use to Add record in the database, i also want the new record which will be added in the access database is having some unique no like CRC-CC-date/month/year-incremental number? I mean as soon anyone will hit the add...
0
2043
by: emalcolm_FLA | last post by:
Hello and TIA for any help with this non profit Christmas assistance project. I have an applicant (app history) and child (child history) tables (4 total). I need to grab the next available (in house case number, appt date and time) for the applicants yearly history and the childs yearly history and then print a report with the applicants info and this in house case number. The forms are linked with ID_app (from the applicant table).
0
1999
by: Andy_Khosravi | last post by:
I'm having issues with updates being blocked due to some sort of record locking issue. The error does not occur consistently, so I've had a hard time nailing it down. It does happen enough to cause major problems for my users though as they are working in this all day. I've been pounding my head against the wall for the last week trying to get this figured out. BACKGROUND I have an Access 03 DB that is split with the BE on a network...
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9396
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
9256
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
8263
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...
0
6081
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
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2226
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.