Jump to content

code cleanup


jimfog
 Share

Recommended Posts

if((isset(get[package]))or(isset[submitbuzusersolo])or(isset[submitbuuser[multi]]))

{
 if(isset(get[package]))AND(get[pakage])==solo)AND(isset[submitbuzusersolo])
   {
     //display package/payment image
     if(isset[submitbuzusersolo])
        {//make vaidation checks}
        //display form
   }
   
     if(isset(get[package]))AND(get[pakage])==multi)AND(isset[submitbuzusermulti])
   {
     //display package/payment image
     if(isset[submitbuzusermulti])
        {//make vaidation checks}
        //display form
   }

}

else
{
//display pakage/payment images
}

Take a look at the above pseudo code.

It achieves the following:

When the user comes first to this page it sees 2 images related to the packages offered(it is a SAAS site).

When the user clicks the image package that interests him the image package stays in the viewport and below it a registration form appears

When the user clicks the submit button the image stays in the viewport-in case the form has errors or if errors are not found redirection will take place....in logged in page.

 

Question:

Can the above happen with a cleaner code? Before ending up in this code I have tried other versions and the problem was that -for example-when the user submitted the form(and in the case of errors) the image was gone from the viewport. 

Another similar problem was that when the user cicked the package image no form was displayed...all these issues due to bad code orgganisatio.

But to achieve what I wanted I had to resort to the above complex code...so can it be  done cleaner

 

 

 

 

 

Link to comment
Share on other sites

Is it possible to work on actual code instead of pseudo code?

Link to comment
Share on other sites

3 hours ago, niche said:

Is it possible to work on actual code instead of pseudo code?

You are asking me to create a fully functional PHP page...where I can do that? I am just asking

Link to comment
Share on other sites

Something like that.  We could make it at least partially functional by focusing on one thing.

First question, are you using a design pattern like MVC? 

Link to comment
Share on other sites

18 hours ago, niche said:

Something like that.  We could make it at least partially functional by focusing on one thing.

First question, are you using a design pattern like MVC? 

Where can I upload the code? No I am not usingg MVC

Link to comment
Share on other sites

So, lets do it procedurally.  

There's no code to upload because you'll write it and everyone can help you especially me.  That's one of the big advantages of using this Code Forum.

You have 30 likes, 1,760 posts, and been coding for at least ten years!  You can do this!

EDIT:

In the time it takes to find the code object, library, or framework that MIGHT do what you need it to do, you probably could've written the code you needed from scratch, WHEN YOU KNOW HOW TO CODE.

Unless, you don't plan to answer the emails, texts and phone calls you'll get after enough users become unhappy with your patches.

jimfog, this edit isn't directed at you necessarily.  I simply want everyone to know that learning to write your own code is a superpower that should always be developed and used to the fullest extent possible.   

 

Edited by niche
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...