ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi guys Ive got a page that allows me to delete or modify users.....the page lists all the users with a radio button besides them and at the end of hte page the user can click either delete or modify ........if the user clicks delete I will delete the user and return the user to the same page again ( Ive already done that, the form action submits to itself)....if the users clicks modify I want to take the user to another page with the value of the radio button he chose
if (isset($_POST['delete'])){
//continue on this page done
}
if (isset($_POST['modify']){
//go to modify page and take radio button value there "????"
}
if (isset($_POST['delete'])){
//continue on this page done
}
if (isset($_POST['modify']){
//go to modify page and take radio button value there "????"
header('Location: modify.php?value=blah');
}
I would do it differently. I wouldn't send the 'delete' to the same page. I would have another radio button that specified 'delete' or 'modify' and submit the form to a new page where:
Iam really new to PHP... Iam a Java programmer and the idea in java is to spare code whenever you can and reuse it.....if I would send the delete to another page I would have to represent the same code of the first page on that page since the user might want to delete another user...
Is it normal in PHP to represent the same code in diff page although there is no real need for it ?
It's really thorough, and it should answer any particular syntax/usage questions you might have. Like any other language, your code reuse really depends on you - usually, when I'm doing forms like the one you're doing, I just have different functions in the same template (sometimes via "include()" as the previous poster suggested), and keep resubmitting the form to the same page, varying the value of a hidden form variable depending upon which part of the template I want processed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.