|
-
Aug 4th, 2002, 11:21 PM
#1
Thread Starter
Lively Member
submit button wont post
hey all,
as some of you may know, i have been having a ot of difficulties getting a form to work. i have now found the problem. the $HTTP_POST_VARS wont recognise that the submit button has a value. the following WONT work.
PHP Code:
<?
if(isset($HTTP_POST_VARS['submit'])) {
mail('[email protected]',$_REQUEST['subject'],$_REQUEST['message'] . '\n\nFrom,\n' . $_REQUEST['from_name'],'From: ' . $_REQUEST['from_email']);
echo "<b><center>Mail sent!</center></b><br>\n<a href=\"index.php\">Return to home</a><br>\n";
} else {
?>
<center><b>Email |DJ| P@CkMaN</b></center>
<form method="post" action="contact.php?action=webmaster">
Your name: <input type="text" name="from_name" size="35"><br>
Your email: <input type="text" name="from_email" size="35"><br>
Subject: <input type="text" name="subject" size="39"><br>
Message:<br>
<textarea rows="15" cols="38" name="message"></textarea><br>
<input type="image" src="../images/buttons/submit.gif" value="Submit" alt="Submit!" name="submit">
<?
}
?>
but if i check that the user typed something in message like this script
PHP Code:
<?
if(isset($HTTP_POST_VARS['message'])) {
mail('[email protected]',$_REQUEST['subject'],$_REQUEST['message'] . '\n\nFrom,\n' . $_REQUEST['from_name'],'From: ' . $_REQUEST['from_email']);
echo "<b><center>Mail sent!</center></b><br>\n<a href=\"index.php\">Return to home</a><br>\n";
} else {
?>
<center><b>Email |DJ| P@CkMaN</b></center>
<form method="post" action="contact.php?action=webmaster">
Your name: <input type="text" name="from_name" size="35"><br>
Your email: <input type="text" name="from_email" size="35"><br>
Subject: <input type="text" name="subject" size="39"><br>
Message:<br>
<textarea rows="15" cols="38" name="message"></textarea><br>
<input type="image" src="../images/buttons/submit.gif" value="Submit" alt="Submit!" name="submit">
<?
}
?>
it all works great??
could someone please tell me whats going on and if theres a way that i can make it work with $HTTP_POST_VARS['submit']??
thanks heaps
There's something I've noticed in the last year or so...
Australian's are good at EVERYTHING !!!
-
Aug 5th, 2002, 07:38 AM
#2
Frenzied Member
try adding onclick="document.submit();"
to the image submit button.
<input type="image" src="../images/buttons/submit.gif" alt="Submit!" name="submit" onclick="document.submit();">
-
Aug 5th, 2002, 07:52 AM
#3
Fanatic Member
cant $REQUEST be used instead of $HTTP_POST_VARS
-
Aug 5th, 2002, 07:55 AM
#4
Frenzied Member
-
Aug 5th, 2002, 08:02 AM
#5
-
Aug 5th, 2002, 08:06 AM
#6
Fanatic Member
Ok I am in a daze, phpman you already figured it out, but the thing you wrote does not work for me.
-
Aug 5th, 2002, 09:38 AM
#7
Frenzied Member
try it a couple of ways.
<input type="image" src="../images/buttons/submit.gif" alt="Submit!" name="submit" onclick="submit();">
<input type="image" src="../images/buttons/submit.gif" alt="Submit!" name="submit" onclick="this.document.submit();">
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|