- This topic is empty.
-
AuthorPosts
-
April 15, 2011 at 1:18 am #32365mshort1985Member
Hi Folks,
I am just out of interest messing around with PHP trying to make a form which will edit an entry in the database. would this be the right way to go about it?
What i’ve done is used the GET function to collect the ID of the entry then passed that into the form action URL
AstraParticipantHello, I also had some problems with making the entry in database. I am not good in coding, so i spent plenty of time trying to write it corrrectly, but I just wasted my time. I asked my friend who recently made a great personal web site, and he advised me to find a program that will build a form itself, as for me, I found phpforms, and now everything is ok.
April 18, 2011 at 11:00 am #50434lyleyboyMemberWhat you have suggested seems fine.
Just a quick bullet point list of things to do.
The list is displayed somewhere. The URL has the ID of the entry in a get variable.
In your page do a query to find all the info for that entry. the sql query would be something like
SELECT * FROM YOURTABLE WHERE ItemID=’$_GETNow run through the building the form inside a while loop. Use the while loop to fill in the form value fields.
Now in the update page,
Collect all the variables and name them properly.
Now clean up the variables (Lookup sql injection if you’re not sure)
Now update the table like
UPDATE YOURTABLE SET field1=’$field1′, field2=’$field2′ WHERE ItemID=’$_GETAnd that should be that
AuthorPostsViewing 3 posts - 1 through 3 (of 3 total)- The forum ‘Back End’ is closed to new topics and replies.