Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

parts of site DISSAPEARING after form code


jeremiah11

Recommended Posts

Posted

Hi everyone,

 

I am building a form and a validator in a already existing webpage and for some reason all my images/text/everything dissapears when i put either the validation code in or a call to the validation code.

 

i am guessing you cannot put a

 

<?php

 

error_reporting(E_ALL);

if (!isset($submit)) {

exit;

}

 

require '....etc....etc.....etc

 

right in the middle of the code because it makes it break. I am looking for a knowledgable php person to just give me the simple solution or what tage <tr>, <td>'s or where i need to place this file in oscommerce to make this work.

 

Any suggestions would be great.

 

Thanks,

Jeremiah

Posted
error_reporting(E_ALL);

if (!isset($submit)) {

exit;

}

 

require '....etc....etc.....etc

 

i don't think your code is breaking, i think it's just not doing what you are expecting it to do.

 

what this code is doing is checking to see if a variable named '$submit' has a value, and if it does not - the script terminates. it doesn't execute the rest of the code, it just stops. and this is what is giving you the blank page. i also don't think you need the call to error_reporting(), since what is happening is not an error. as far as the script is concerned it's being told to exit normally, and it is doing so. no error.

 

you probably don't want to use exit. instead, at the beginning of the code do $is_form_valid = true. then, at each one of your validation checks, do $is_form_valid = false if the submitted data is wrong.

 

take a look at some of the other pages that have forms. find something simple like the contact_us.php page and see how they handle the data, what the <form> tags look like, etc. and model your code after that. its usually easier to take some existing (working!) code and modify it rather than coming up with all new code.

 

i hope this helps.

Posted
i don't think your code is breaking, i think it's just not doing what you are expecting it to do.

 

what this code is doing is checking to see if a variable named '$submit' has a value, and if it does not - the script terminates. it doesn't execute the rest of the code, it just stops. and this is what is giving you the blank page. i also don't think you need the call to error_reporting(), since what is happening is not an error. as far as the script is concerned it's being told to exit normally, and it is doing so. no error.

 

you probably don't want to use exit. instead, at the beginning of the code do $is_form_valid = true. then, at each one of your validation checks, do $is_form_valid = false if the submitted data is wrong.

 

take a look at some of the other pages that have forms. find something simple like the contact_us.php page and see how they handle the data, what the <form> tags look like, etc. and model your code after that. its usually easier to take some existing (working!) code and modify it rather than coming up with all new code.

 

i hope this helps.

 

 

Thanks for the advice, i actually just took those two lines out without adding anything and things seem to be working ok except that i am getting a "The website you have requested does not exist" error from my hosting company in the middle of the page....BUT all the functionality is there and all the images are back. So i believe for some reason i am either calling something i dont need to or i am missing something very small....

 

Do you have any idea what this could be?

Again, thanks for the advice,

Jeremiah

Posted
except that i am getting a "The website you have requested does not exist" error from my hosting company in the middle of the page....BUT all the functionality is there and all the images are back. So i believe for some reason i am either calling something i dont need to or i am missing something very small....

 

Do you have any idea what this could be?

 

what is your site's address? it'll be easier if i can just take a look at it and view the generated html.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...