Jump to content

URGENT! - can anyone see why this won't work?


Gazza_NZ

Recommended Posts

hi,

 

i've got some code for an assignment that, as far as i'm aware, should work fine.

 

BUT... it won't display the next page when button clicked like it should

 

anyone got any ideas why? i'm stumped

$self = $_SERVER['PHP_SELF];

 

echo("<form action = '$self' method = 'POST'>");

//code here

echo("<td><input type = 'checkbox' name = 'remove[]' value = '$name'> Delete $name</td>");

  echo("</tr>");

}

echo("<tr>");

  echo("<td colspan = '6'><input type = 'submit' name = 'removeData' value = 'Delete Pet Records'></td>");

echo("</tr>");

echo("</table>");

echo("</form>");

 

} else if(isset($_POST['enterData'])){

 

// more code here

 

any help greatly appreciated

 

Gazza

kinda hard to tell when 90% of that code is just echoing.

 

sorry, but unless you want to see the whole lot... (not recommended, its not the neatest code around)

 

all its got is a checkbox and a button in a table, the form is self referencing, the button name is the same as in the isset... it should work right? all the others do

BUT... it won't display the next page when button clicked like it should ...

 

There is no NEXT page. The form posts to itself.

 

self referencing form, $_POST will have a value set when the button is clicked, and it should skip over previous code to the part i'm wanting to display.  i know that much, because it works with other parts of the page

What exactly if your definition of "work right". No, we don't want to see all the code, but it might be worth posting the code that's relevant to whatever doesn't work the way you expect, especially when "all the others do" (which is particularly cryptic in the context of the questions you've posed.

just noticed i got the wrong bit of code up there...

 

 

echo("<td colspan = '6'><input type = 'submit' name = 'modifyData' value = 'Edit This Pet'></td>");

//code to finish table and form

} else if(isset($_POST['modifyData'])){

 

thats the part not working...

What exactly if your definition of "work right". No, we don't want to see all the code, but it might be worth posting the code that's relevant to whatever doesn't work the way you expect, especially when "all the others do" (which is particularly cryptic in the context of the questions you've posed.

 

sorry, new here, assignment's due in 4 hrs, working on getting extra marks...

 

 

by "work right" I mean it should display the next section appropriate to the button.

 

by "all the others do" I mean that on other parts of the page I do the same thing, self referencing form that when a button is clicked, it displays a different "page" to the "page" that was up before the button was clicked

Archived

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

×
×
  • 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.