473,700 Members | 2,773 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 1826
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
8790
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
4332
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
2204
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
12099
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
2399
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
15423
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
2409
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
2263
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
2039
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
1996
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
8714
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
9203
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9060
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...
1
8958
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7797
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
6557
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
5897
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();...
1
3082
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
2
2379
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.