php worked with wamp not xampp

Problems with the Windows version of XAMPP, questions, comments, and anything related.

php worked with wamp not xampp

Postby egnarts11 » 09. January 2017 23:43

When I submit I receive a 403 error

<h1>Add or update the Description of your property</h1>
<form method ="post" action = "<?php update() ?>" >
<input type="hidden" name="filename" value="description" >
<textarea name="content" rows="5" cols="100">Warning upon pressing "Update" your description will be changed.</textarea><br/><br/>

<input type="submit" name="descriptionUpdate" value="Update"/>

</form>


function update ()
{
if(isset($_POST[$_POST['filename'].'Update']))
{
$file = 'http://localhost/myweb/data/'.$_POST['filename'].'.txt';
if(!empty($file))
{
file_put_contents($file,$_POST['content']);
}else{print "The" .$_POST['filename']. "is blank....";}
}
}
Thanks in advance for your assistance...
egnarts11
 
Posts: 2
Joined: 09. January 2017 23:38
XAMPP version: 3.2.2
Operating System: windows 10

Re: php worked with wamp not xampp

Postby Nobbie » 10. January 2017 12:24

Can you explain, which contents you expect for the action-TAG?

Code: Select all
<form method ="post" action = "<?php update() ?>" >


Actually, that code is a total nonsense. You cannot specify a PHP function in a form a action. You have to specify an URL (i.e. a filename of an PHP Script or similar). The form is interpreted (and "executed") by the browser, but the PHP Code is executed on the server BEFORE the form is sent to the browser. This never worked anywhere.
Nobbie
 
Posts: 9761
Joined: 09. March 2008 13:04

Re: php worked with wamp not xampp

Postby Altrea » 10. January 2017 17:54

CTRL + U = Browser Sourcecode View
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8961
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: php worked with wamp not xampp

Postby egnarts11 » 18. January 2017 23:28

Well I recoded the form action so that it directed to a php file and it worked.

Thank you for your assistance!
egnarts11
 
Posts: 2
Joined: 09. January 2017 23:38
XAMPP version: 3.2.2
Operating System: windows 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 55 guests