Current location: Hot Scripts Forums » Programming Languages » PHP » submit form?


submit form?

Reply
  #1 (permalink)  
Old 12-12-03, 11:26 AM
tcooper tcooper is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
submit form?

I have a form and I have a field on the form that submits the form when the user exits the field. The form values are POST and $PHP_SELF.

I want to be able to submit the form to another form if the "Submit" button is clicked. How can I do this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-12-03, 12:00 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
what you are talking about is not very clear .. but change the action in the form tags to the file you want like this :
Code:
<form method="POST" action="new_file.php">
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 12-12-03, 12:11 PM
tcooper tcooper is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
How do I change this? I want the form to submit to itself in some instances and then to another page in other instances. I know I have to change the action of the form but don't know how. Your help is appreciated.

Quote:
Originally Posted by NeverMind
what you are talking about is not very clear .. but change the action in the form tags to the file you want like this :
Code:
<form method="POST" action="new_file.php">
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 12-12-03, 01:01 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
well , it depends on what are the conditions you want ..
like when do you want it to be submited to itself and when do you want it to be sent to another ?
anyway IF statments are your friends in this case ..
example :
PHP Code:

if ( $condition_1 === true ) {

$dist=$_SERVER['PHP_SELF']; //this will post to the file itself ..
} elseif ( $condition_2 === true ) {
$dist='new_file.php'//the other file you want to post to ..
}

echo
'<form method="POST" action="'.$dist.'">'
that's how you change the direction of the file ..
but give us more details so we can help more ..
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]

Last edited by NeverMind; 12-12-03 at 01:04 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 12-12-03, 03:08 PM
tcooper tcooper is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you very much for your help. I new there should be some type of if or function or something but just could not get it figured out. This really helps.

Quote:
Originally Posted by NeverMind
well , it depends on what are the conditions you want ..
like when do you want it to be submited to itself and when do you want it to be sent to another ?
anyway IF statments are your friends in this case ..
example :
PHP Code:

if ( $condition_1 === true ) {

$dist=$_SERVER['PHP_SELF']; //this will post to the file itself ..
} elseif ( $condition_2 === true ) {
$dist='new_file.php'//the other file you want to post to ..
}

echo
'<form method="POST" action="'.$dist.'">'
that's how you change the direction of the file ..
but give us more details so we can help more ..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 12-12-03, 04:30 PM
woyrz's Avatar
woyrz woyrz is offline
Newbie Coder
 
Join Date: Dec 2003
Location: montreal
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by tcooper
Thank you very much for your help. I new there should be some type of if or function or something but just could not get it figured out. This really helps.

I use a simple way to do understand i think

You create a hidden field inside your form. Name it viewform or whatever!!
<form action= <?php print $_SERVER['PHP_SELF'] ?> method="post">
<?php
if (!isset($_POST[viewform])){
the form
RELY IMPORTANT
<input name=\"viewform\" type=\"hidden\" value=\"view\">
}
if($_POST[viewform] == "view"){
the send form procedure
}
?>
that should work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
formmail problem gscraper Perl 12 08-27-04 04:06 AM
redirect on form submit simone PHP 11 11-25-03 01:01 PM
Why I always get \' and \" after I submit the form ! kevin PHP 4 11-24-03 05:57 AM
question on form and submit TxRanger JavaScript 2 11-03-03 12:28 PM
process form without press submit button azwani JavaScript 1 11-03-03 02:10 AM


All times are GMT -5. The time now is 08:15 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.