monkeybidz Posted November 17, 2007 Share Posted November 17, 2007 I tried setting the form action as: <?=$postar;?> <?=$postar?> <? print $postar;?> The form is to post to itself depending on the set mode. Here is the code. <? if($mode=="recall"){ $postar="sell.php?mode=recall"; }else{ $postar="sell.php"; } ?> <form action="<? echo $postar; ?>" method="post" name="zipcodestuff" target="_self" id="zipcodestuff"> I need it to post $postar in form action. Quote Link to comment https://forums.phpfreaks.com/topic/77692-problem-defining-form-action/ Share on other sites More sharing options...
axiom82 Posted November 17, 2007 Share Posted November 17, 2007 <form action="form.php" method="post"> <input type="hidden" name="mode" value="<?php echo $_POST['mode'] ?>"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/77692-problem-defining-form-action/#findComment-393288 Share on other sites More sharing options...
monkeybidz Posted November 17, 2007 Author Share Posted November 17, 2007 that will only get it to post back in the form field. I need it to echo as the action to determine where the form will post to. Quote Link to comment https://forums.phpfreaks.com/topic/77692-problem-defining-form-action/#findComment-393295 Share on other sites More sharing options...
phpQuestioner Posted November 17, 2007 Share Posted November 17, 2007 try this: <?php $mode = $_GET['mode']; if ($mode == "recall") { $postar="sell.php?mode=recall"; } else { $postar="sell.php"; } ?> <form action="<?php echo "$postar"; ?>" method="post" name="zipcodestuff" target="_self" id="zipcodestuff"> you will missing you double quoates Quote Link to comment https://forums.phpfreaks.com/topic/77692-problem-defining-form-action/#findComment-393303 Share on other sites More sharing options...
monkeybidz Posted November 17, 2007 Author Share Posted November 17, 2007 That does the same thing I had, only problem I am having, is that the form is multipart and when the first part is submitted, it is to post to itself and keep other variable from the second form which are pre defined since this page is a page that is bieng edited by a user. When i submit the form, all other vars are lost. Quote Link to comment https://forums.phpfreaks.com/topic/77692-problem-defining-form-action/#findComment-393327 Share on other sites More sharing options...
phpQuestioner Posted November 17, 2007 Share Posted November 17, 2007 create a session for "mode" variable and echo out your session in you form action something like this: <form action="<?php echo $_SESSION['mode']; ?>"> Quote Link to comment https://forums.phpfreaks.com/topic/77692-problem-defining-form-action/#findComment-393329 Share on other sites More sharing options...
phpQuestioner Posted November 17, 2007 Share Posted November 17, 2007 try this monkeybidz: <?php session_start(); if ($mode == "recall") { $postar="". $_SERVER['PHP_SELF'] ."?mode=recall"; } else { $postar="". $_SERVER['PHP_SELF'] .""; } $_SESSION['mymode']="$postar"; ?> <html> <head> <title>Untitled</title> </head> <body> <form name="zipcodestuff" action="<?php echo $_SESSION['mymode']; ?>" method="post"> <input type="submit"> </form> </body> </html> I think this should do what you want it to do. Quote Link to comment https://forums.phpfreaks.com/topic/77692-problem-defining-form-action/#findComment-393337 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.