Current location: Hot Scripts Forums » Programming Languages » PHP » $_POST doesnot run


$_POST doesnot run

Reply
  #1 (permalink)  
Old 08-12-09, 05:02 AM
zodehala zodehala is offline
Wannabe Coder
 
Join Date: Mar 2007
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
$_POST doesnot run

Code:
<form id="bireysel" name="form_bireysel" method="POST" action="x.php?do" enctype="application/x-www-form-urlencoded">
<!-- form is here -->
</form>
x.php

PHP Code:

if ($_POST["do"]) {

        foreach(
$_POST as $a=>$b){
            echo 
$a" : "$b."<br/>";
        }


i can not get data into x.php coming from form
Reply With Quote
  #2 (permalink)  
Old 08-12-09, 05:04 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Remove the enctype attribute from your form.

EDIT:

Also, you're passing the variable "do" via GET in your action attribute. And it doesn't contain a value either, so your if ($_POST['do']) would be false.

Last edited by Nico; 08-12-09 at 05:15 AM.
Reply With Quote
  #3 (permalink)  
Old 08-12-09, 10:29 AM
zodehala zodehala is offline
Wannabe Coder
 
Join Date: Mar 2007
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
form

Code:
<form id="bireysel" name="form_bireysel" method="POST" action="x.php?badsl">
<!-- form is here -->
</form>
x.php
PHP Code:

if ($_POST["badsl"]) {

        foreach(
$_POST as $a=>$b){
            echo 
$a" : "$b."<br/>";
        }

and it does not run again
Reply With Quote
  #4 (permalink)  
Old 08-12-09, 11:13 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
All variables that you put in the "action" attribute, after the file name, will be passed via GET, and not POST.
Reply With Quote
  #5 (permalink)  
Old 08-12-09, 11:51 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
You can use $_REQUEST - but read the link below.

Responsible use of the $_REQUEST variable.
Reply With Quote
  #6 (permalink)  
Old 08-12-09, 06:02 PM
zodehala zodehala is offline
Wannabe Coder
 
Join Date: Mar 2007
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
this is url bar text

PHP Code:

http://localhost//x.php?kullaniciadi..... 

like you see no "badsl" text after question mark . where is the problem ?
Reply With Quote
  #7 (permalink)  
Old 08-12-09, 06:27 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Quote:
Originally Posted by Nico View Post
All variables that you put in the "action" attribute, after the file name, will be passed via GET, and not POST.
^ ^ ^

...........

HTML Code:
 action="x.php?badsl"
^ GET

PHP Code:

 if ($_POST["badsl"]) { 

^ POST.
Reply With Quote
  #8 (permalink)  
Old 08-13-09, 11:58 AM
zodehala zodehala is offline
Wannabe Coder
 
Join Date: Mar 2007
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
y.html


Code:
<form id="form1" name="form1" method="GET" action="x.php?badsl">
  	<input type="text" name="textfield" /><br />
 	<input type="text" name="textfield2" /><br />  
  	<input type="submit" name="Submit" value="Submit" />  
</form>
y.php
PHP Code:

<?php

if($_GET['badsl']){
    foreach(
$_GET as $a=>$b){
        echo 
$a." : ".$b."<br/>";
    }
}
this is browser adress bar
Code:
http://localhost/x.php?textfield=sda&textfield2=dsfad&Submit=Submit
iam using xp_sp3 and xampp 1.7.1

why does not it run

where is the problem ?
Reply With Quote
  #9 (permalink)  
Old 08-13-09, 12:13 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
HTML Code:
<form id="form1" name="form1" method="POST" action="x.php?badsl=1">
  	<input type="text" name="textfield" /><br />
 	<input type="text" name="textfield2" /><br />  
  	<input type="submit" value="Submit" />  
</form>
PHP Code:

if (isset($_GET['badsl']))

{
    foreach(
$_POST as $a => $b)
    {
        echo 
$a." : ".$b."<br/>";
    }

Reply With Quote
  #10 (permalink)  
Old 08-13-09, 12:50 PM
zodehala zodehala is offline
Wannabe Coder
 
Join Date: Mar 2007
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
blank page again
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
automatically send email to the particular person everyday sujata_ghosh PHP 7 10-04-11 05:00 PM
Run Your Own Uptime Monitoring Service hostthebest General Advertisements 3 05-25-08 07:39 PM
Run Your Own Storage Service hostthebest General Advertisements 4 03-12-08 11:59 PM
Trying to recode my php script into c to run on linux... DaJackal C/C++ 1 02-03-06 08:22 PM
Global Arrays and crontab johnnytalent PHP 3 11-25-05 09:59 AM


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