Matrix001 Matrix001 - 1 year ago 61
HTML Question

Opening a new page in php on a button press

I want a new page to be opened when a button is pressed. Here is my code so far:

<input name="newThread" type="button" value="New Discussion" onclick="'Political/Thread/thread_insert.php')"/>

It fails, however, ..I think the path is incorrect, but I dont know why..cause it is the correct directory path...

Answer Source

Your code is correct (valid and function), you problem is the your path.

Remember that page location is the page inside the web server and relative to the current page location.

So if your web server root is for example c:\wamp\www then the web address test/test.php will look for the real page of c:\wamp\www\test\test.php. However the same address encoded into a page already in a subdirectory will be relative unless it starts with / So from the page test/test.php in the above example the link to test/test.php will become /test/test/test.php (with a real path of c:\wamp\www\test\test\test.php)

If you have copied the link from another page somewhere this is probably the problem

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download