Jump to content

[SOLVED] Nested (echoed) php running wrong script


cactuscake

Recommended Posts

Got a problem with a php website I'm creating.

 

In a nutshell, the first page is entirely html and calls a php script to process an uploaded file and some form fields using POST. After validating the uploaded file the script echos a new page with a new form containing hidden inputs to carry forward the extra information provided in the original form (this was easier than getting my head around cookies). It works, because when I view the generated source all of the hidden input values have been populated with the correct information.

 

The problem I am having is with the next part of the process - the echoed page includes a new button that is supposed to call a separate php script, using the new form values. But when the button is clicked, it executes the existing php script again (and fails on the validation) instead of running the correct script as referenced in the onClick attribute of the button.

 

Any idea what I'm doing wrong? or why it is behaving like this?

Link to comment
Share on other sites

Why are you using the onClick attribute. Providing you have something like...

 

<form action="script_to_post_to.php" method="post">
<!-- your fields here -->
<input type="submit" value="Submit Form" />
</form>

Link to comment
Share on other sites

Using onclick because the input type is an image... can't get into my host server at the moment to test a simple submit button but will try that as soon as I'm back in.

 

uggh! Looks like the server has been down for several hours... I guess I'm going to have to wait until tomorrow to sort it out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.