0

When I don't specify the URL it returns doctor_results as I had expected. enter image description here

But when I change it by adding enter image description here

It also renders doctor.html but doesn't return doctor_results.html unlike when the route is '/'. Instead, it gives me an error of Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. and the url returns to localhost:5000

The POST in doctor.html looks like this: enter image description here

Joy Gracia
  • 13
  • 3

1 Answers1

0

Simply change <form method='POST' action='/'> to <form method='POST' action='/Medical'> should work.

Action attribute specifies the route that handles the form inputs when you click submit. Although you changed app route from '/' to '/Medical', the html file still looks for '/' when you click submit, but now that you have changed that route in flask and '/' route doesn't exist anymore, so it returns "Not Found".

Walnut
  • 71
  • 5
  • @JoyGarcia - And better yet, use `url_for(‘index’)`. [Here is a similar post](https://stackoverflow.com/a/35936261/6340496). – S3DEV Aug 16 '20 at 20:56