PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello all!!!! new to the forum and php nightmare!
iam having trouble with this script iam trying to make what iam trying to do it have a 2 forms in 1 document but only display 1 at a time depending on the condition
ive got a form which is used to add to a mysql table and 1 to update i want the add 1 to be visable all the time until the user clicks edit then it gets replaced by a update form
this is the code for the update query would i need to out it in some sort of if statment like if $_Get['editreult'] is clicked echo Update form else echo Add form??? new to php so help with be greatful
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
You need to be aware that PHP is server side scripting, that means once it leaves the server there is NO MORE PHP in the document, so it can't possibly react to something the user does after her browser receives the HTML!
Saying it another way, if you want something to happen based on user interaction, you HAVE TO use client side scripting, such as Javascript. The PHP can send the Javascript to the browser, but any action you want to happen must be done in the Javascript.
Hi thanks for your help both ive been messing around with what you said ok and got the form to replace when the links clicked. The only problem I have now is getting the update results to appear in the form i can echo the results no problem but when i try to echo them in the form they dont appear i had it working fine with the mysql_results way but the mysql_fetch_assoc seems far more pratical. any ideas why the value arent appearing in the form? heres my modified code
hmmm abit lost but i need to get the values from the database using the get function so that they can be updated, is the form method="POST" idol until i click the submit button at that time it runs upload which is all post?
not really sure what iam talking about to be honest new to php
Your Problem Can Be Solved Easily By Client Side javaScript Only Without any Hardcoded php.
You Should First Design Your Page With JavaScript
And Then Use
The determination of using $_POST or $_GET in your PHP is based on your HTML form. The interaction with the database does depend on either.
If you need to pass the editresult information with the form you could save it as a hidden field .