473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem submitting previously working form on new server

Hello, I'm a php newbie and have been using the following php code fine
(until now) to submit a form and create an email message. I recently
moved the site from a local server to an ISP's server and now, whenever
I attempt to submit the form, the entries I made are cleared and no
e-mail is sent.

I have no idea what the problem is - can anyone help?
------------begin extracted php---------------
<?php
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
$me = $_SERVER['PHP_SELF'];
print <<<TOEND

<form name="form1" method="post" action="$me">

Name: <input type="text" name="Name">
Subject: <input type="text" name="Subject"></td>
Message: <textarea name="MsgBody"></textarea></td>
<input type="submit" name="Submit" value="Send"></td>

</form>

TOEND;

} else {
error_reporting(0);
$recipient = 'a***@innovez.co.uk';
$subject = stripslashes($_POST['Subject']);
$from = stripslashes($_POST['Name']);
$msg = "Message from: $from\n\n".stripslashes($_POST['MsgBody']);
if (mail($recipient, $subject, $msg))
echo nl2br("<b>Message Sent:</b>
To: $recipient
Subject: $subject
Message:
$msg");
else
echo "Message failed to send";
}
?>
------------end extracted php---------------
Jul 17 '05 #1
7 1794
["Followup-To:" header set to comp.lang.php.]
a c s wrote:
Hello, I'm a php newbie and have been using the following php code fine
(until now) to submit a form and create an email message. I recently
moved the site from a local server to an ISP's server and now, whenever
I attempt to submit the form, the entries I made are cleared and no
e-mail is sent.

I have no idea what the problem is - can anyone help?
(... snip ...)
} else {
error_reporting(0);


Try
error_reporting(E_ALL);

instead.
Then correct all Notices, Warnings and Errors, and repost if it still
doesn't work.

--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #2
Hi Pedro,

I have changed the error_reporting function to E_ALL but there is no
change in behavior: the form just resets itself.

Any other ideas? With thanks, Alan.
Pedro Graca wrote:
["Followup-To:" header set to comp.lang.php.]
a c s wrote:
Hello, I'm a php newbie and have been using the following php code fine
(until now) to submit a form and create an email message. I recently
moved the site from a local server to an ISP's server and now, whenever
I attempt to submit the form, the entries I made are cleared and no
e-mail is sent.

I have no idea what the problem is - can anyone help?

(... snip ...)

} else {
error_reporting(0);

Try
error_reporting(E_ALL);

instead.
Then correct all Notices, Warnings and Errors, and repost if it still
doesn't work.

Jul 17 '05 #3
a c s top-posted:
I have changed the error_reporting function to E_ALL but there is no
change in behavior: the form just resets itself.

Any other ideas? With thanks, Alan.


Hmmm ... It worked perfectly here.

What PHP version is running on your server?

<?php echo phpversion(); ?>
$_SERVER, $_POST, ... are available from PHP 4.1.0 onwards.
If you use an earlier version substitute those superglobal arrays with
$HTTP_SERVER_VARS, $HTTP_POST_VARS, ...

http://www..php.net/manual/en/reserved.variables.php
--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #4
Sir, you are a genius - the version of PHP on the server was 4.0.6.

The workaround sorted the problem nicely, and it'll be added to my
troubleshooting list for the future.

Thanks again, Alan.

Pedro Graca wrote:
a c s top-posted:
I have changed the error_reporting function to E_ALL but there is no
change in behavior: the form just resets itself.

Any other ideas? With thanks, Alan.

Hmmm ... It worked perfectly here.

What PHP version is running on your server?

<?php echo phpversion(); ?>
$_SERVER, $_POST, ... are available from PHP 4.1.0 onwards.
If you use an earlier version substitute those superglobal arrays with
$HTTP_SERVER_VARS, $HTTP_POST_VARS, ...

http://www..php.net/manual/en/reserved.variables.php

Jul 17 '05 #5
Hi Pedro,

Have you any idea why (it seems only in PHP versions less than 4.1.0)
the attachment received is an empty "attachment.txt" file instead of the
actual file I attached?

Many thanks in advance, Alan.

Pedro Graca wrote:
a c s top-posted:
I have changed the error_reporting function to E_ALL but there is no
change in behavior: the form just resets itself.

Any other ideas? With thanks, Alan.

Hmmm ... It worked perfectly here.

What PHP version is running on your server?

<?php echo phpversion(); ?>
$_SERVER, $_POST, ... are available from PHP 4.1.0 onwards.
If you use an earlier version substitute those superglobal arrays with
$HTTP_SERVER_VARS, $HTTP_POST_VARS, ...

http://www..php.net/manual/en/reserved.variables.php

Jul 17 '05 #6
a c s top-posted:
Hi Pedro,
To mail me use my address and follow the indications in the signature.
If you ask me something by mail I probably will tell you to ask in the
newsgroup instead :)
Have you any idea why (it seems only in PHP versions less than 4.1.0)
the attachment
Attachment? ?!?!?!? What do you mean?
Something in MIME e-mail, perhaps?
received
received? ?!?!?!? What do you mean?
Received by what?
A mail client?
A HTTP server?
A IRC client?

And, if it was received, it must have been sent. Sent by what?
A PHP script?
A mail client?
An FTP-to-Mail server?
is an empty "attachment.txt" file instead of the
actual file I attached?


Where could the attachment be lost?
One of several places:
a) before being sent
b) at the moment of sending
c) between being sent and received
d) at the moment of receiving
e) after being received

You say it's at c); I guess it's at b) -- or even at a)
Verify your sending script.

PS. What is the relation between the failed "received attachment"
and switching a form to a different server (the subject of this
post)?
--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #7
Pedro. My apologies. My script had a missing semi-colon.

Thanks again, Alan.

Pedro Graca wrote:
a c s top-posted:
Hi Pedro,

To mail me use my address and follow the indications in the signature.
If you ask me something by mail I probably will tell you to ask in the
newsgroup instead :)

Have you any idea why (it seems only in PHP versions less than 4.1.0)
the attachment

Attachment? ?!?!?!? What do you mean?
Something in MIME e-mail, perhaps?

received

received? ?!?!?!? What do you mean?
Received by what?
A mail client?
A HTTP server?
A IRC client?

And, if it was received, it must have been sent. Sent by what?
A PHP script?
A mail client?
An FTP-to-Mail server?

is an empty "attachment.txt" file instead of the
actual file I attached?

Where could the attachment be lost?
One of several places:
a) before being sent
b) at the moment of sending
c) between being sent and received
d) at the moment of receiving
e) after being received

You say it's at c); I guess it's at b) -- or even at a)
Verify your sending script.

PS. What is the relation between the failed "received attachment"
and switching a form to a different server (the subject of this
post)?

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: amit.purohit | last post by:
hi, I have a very strange problem on my login Page. the Page was working fine a few days back, but now does not generate post back events for controls. this login page uses form based...
5
by: Don | last post by:
I have a need to submit a form, but don't need the user to click on a button. How do I do this? Is there some way, using JavaScript, to setup a <form> tag to do this? Thanks, Don ----==...
5
by: Mary Litten | last post by:
Hi - (This is my very first post) I have gotten to this point of registering to post because I have been spinning my wheels so long, I believe I am all caught up in the weeds. (and mud) I have...
3
by: ooper | last post by:
Hello, I have a page with multiple frames. The body frame has an href as follows: http://www.fincalc.com/BUD_02.asp?id=12345&css=demo BUD_02.asp has code that tries to read the id value from...
10
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side...
4
by: john | last post by:
I have an app that uses Server.Transfer from page1 to page2. page2 needs to be able to read all the values from page1's form. The problem is, if the user clicks the back button on page2 after a...
1
by: Naim | last post by:
hi I have this situation where I need to do some server side execution without posting the page. I used to do this in asp using IFrame, but it's not working in asp.net. I had a form and...
1
by: Mahesh Devjibhai Dhola | last post by:
Hi, Scenario: The webservice was developed on windows 2000 Pro and deployed previously on windows XP pro for testing. We have tested for many days. The client for that service was 30+ and...
9
by: Dave | last post by:
Hi guys, I have just set up a duplicate server running: apache 2.54, mysql 5.04 and php 5.04 This is the same setup as as the server we are using now, apart from the hardware inside. I have...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.