hitmanblood
Apr 15 2007, 07:43 AM
| | I have problem I've been doing some programming in php that is something similar to registration but whenever I want to check something it seems like variables are not passed or that the php variables are empty I am using get instead of post however I am also considering to switch to post as I cannot find an error. Anyone had similar experience that he could help me? Thanks in advance. |
Reply
shadowx
Apr 15 2007, 09:41 AM
Is there any chance we can see the code you are using in php and the form code you have used, that would in HTML. Im thinking maybe youve made a little error in the php or on the form. The two things to check are that in php you do something like: CODE <? $var = $_GET['var'];
echo $var; ?> Of course you can do more then ECHO but i usually do that to make my variables easier to manage, the most important bit is $_GET['var']; make sure you have that exactly the same in your scripts, of course change "var" to the variable name. I sometimes forget the underscore and thats never pretty! And on the form make sure you have the "action=" correctly set and the "method=GET" set also. I sometimes write POST on the form and GET in my php and such. Again, thats not very effective! Though if this doesnt solve it then post the part of the php code that gets the GET variables and someone should be able to see if anything is wrong.
Reply
hitmanblood
Apr 15 2007, 01:12 PM
Well OK here it is I will put just parts of code. The beggining of the form: <form action="private/submition.php" method="GET"> Then parts where php script obtians variables values. $username = $_GET['username']; $rank = $_GET['rank']; $email = $_GET['email']; $link = $_GET['link']; Some variables. I really don't see possible mistake as I hvae done this thousand times and now in this particula script it doesn't dowrk. Also I have script on the same server which works with input and it works fine without any problem.
Reply
Blessed
Apr 15 2007, 01:17 PM
Greetings if you want to use the $_GET function the variable you want to get most be in the url lik www.mypage.com?index=your van value now to get that value us $myvalue = $_GET['index']; simple as that you can use more than one var in one link like this www.mypage.com?index=value1&var2=var2value&var3=value3 Have fun with it
Reply
shadowx
Apr 15 2007, 04:43 PM
Well the code looks fine to me too! As Blessed said the variables should be in the URL s check that they are in the URL, if they are then presumably the problem is in the php, if they arent in the URL then it presumably resides in the HTML somewhere. I was going to suggest that it could be something in the settings file or some configuration on the server but you mentioned that other scripts work so its unlikely to be that.
Reply
hitmanblood
Apr 15 2007, 06:44 PM
Well I don't see the problem it kinda eludes me because whenever I try to echo the variable value it is just not there. Is there maybe some kinda of rule for too many variables passed.
Reply
matak
Apr 15 2007, 09:52 PM
QUOTE(hitmanblood @ Apr 15 2007, 08:44 PM)  Well I don't see the problem it kinda eludes me because whenever I try to echo the variable value it is just not there.
Is there maybe some kinda of rule for too many variables passed. I found this code works just fine CODE <form method="GET"> Username: <input type="text" name="username"><br> Rank: <input type="text" name="rank"><br> Email: <input type="text" name="email"><br> Link: <input type="text" name="link"><br> <input type="submit" value="Process"> </form>
<?php
$username = $_GET['username'];
echo $username.'<br>';
$rank = $_GET['rank'];
echo $rank.'<br>';
$email = $_GET['email'];
echo $email.'<br>';
$link = $_GET['link'];
echo $link.'<br>';
?> I really don't know what is your problem, but you could post your full script, with errors if you have any. Also for form submition i would recommend using PHP $_POST instead of $_GET.
Reply
hitmanblood
Apr 15 2007, 10:36 PM
Well yes I know but on the previous server where I tested this script post method was not allowed so I had to use get. And If I try to echo those variables I get just blank spot. So the problem is not in the rest of the script rather in the passing itself. I will also try to switch to the trap17 servers and try to use post method, hopefully it will work.
Reply
matak
Apr 16 2007, 12:05 AM
QUOTE(hitmanblood @ Apr 16 2007, 12:36 AM)  Well yes I know but on the previous server where I tested this script post method was not allowed so I had to use get. And If I try to echo those variables I get just blank spot. So the problem is not in the rest of the script rather in the passing itself.
I will also try to switch to the trap17 servers and try to use post method, hopefully it will work. sure sounds like PHP problem if you tested this script. try running phpinfo on your hosting provider to see the version of PHP they are using. then you should check for compatibility of your code with the version of PHP used at your hosting. i suggest that you use trap17 hosting couse it uses PHP 5.2 which is much better than older versions. Runing phpinfo on your site can be done by you creating info.php file and putting this code inside CODE <?php
phpinfo();
?>
Reply
hitmanblood
Apr 16 2007, 01:11 AM
Thanks matak but I know that and the weird thing is that I have similar script working on that server it is just that this one doesn't want to work. I still cant figure why. But as I am considering to transfer all my work to this host I will check it again and then inform if I have any further problems.
Reply
Latest Entries
matak
Apr 16 2007, 10:08 PM
QUOTE(hitmanblood @ Apr 16 2007, 09:50 PM)  I am not really keen on reveling my code however when I try to echo or print variables after GET methods none of them will show up. That means that it is not problem somewhere later on in the script bu rather in the passing variable value to the php script from the html form. ok i understand that you don't wont to reveal your code. but then again you need to understand that it is really hard for anyone to guess what is wrong with your script when you don't want to show it. i honestly don't belive that you wrote code that is so much valuable so that it can't be shown. maybe your script is full of usernames and passwords which you can't publish, so that would make sense... anyway, i hope that transfering to trap17 and PHP 5 will do the trick
Reply
hitmanblood
Apr 16 2007, 07:50 PM
QUOTE(matak @ Apr 16 2007, 07:01 PM)  well hitmanblood, you didn't post any of your code. in order for anyone to help, you should post both your PHP and HTML code here so that we can see what's the problem more easily. also use code tags to wrap code..  I am not really keen on reveling my code however when I try to echo or print variables after GET methods none of them will show up. That means that it is not problem somewhere later on in the script bu rather in the passing variable value to the php script from the html form.
Reply
matak
Apr 16 2007, 05:01 PM
QUOTE(hitmanblood @ Apr 16 2007, 06:26 PM)  Check the first page. well hitmanblood, you didn't post any of your code. in order for anyone to help, you should post both your PHP and HTML code here so that we can see what's the problem more easily. also use code tags to wrap code..
Reply
hitmanblood
Apr 16 2007, 04:26 PM
QUOTE(Blessed @ Apr 16 2007, 01:48 PM)  can you post your code so i can see it Check the first page.
Reply
Blessed
Apr 16 2007, 11:48 AM
can you post your code so i can see it
Reply
Similar Topics
Keywords : passing, values
- Php An Js Window.open Pages Trouble.
I need a way to set hidden input values to the new window. (3)
[php](simple) Using Functions To Combine Values In A Form
Really simple example on how to combine values with function (2) I just learned this simple method on how to use functions to combine two values from a form. First
we create ourselves a simple POST form CODE <form method="POST"> Name:
<input type="text" name="nickname"> Location: <input
type="text" name="location"> <input type="submit"
value="Input"> </form> Now we add this php to that same file CODE
<?php $nick = $_POST['nickname']; $location =
$_POST['location' ....
Include And Values
(3) hi everybody, i am new to php programming, i have this code in page number 1: CODE <?php
$pages = array( 'number1' => 'number1.php',
'number2' => 'number2.php', 'number3' =>
'number3.php', 'number4' => 'number4.php',
); if (isset($_GET['page']) &&
isset($pages[$_GET['page']])) {
include(....
Converting Characters In A Variable To Individual Values In An Array
turning variables into arrays (2) Say I have a variable such as $nav_item and it had to contents Home . IE: CODE
$nav_item = 'Home'; How would I make so that $nav_item was an array and
had the following contents? CODE $nav_item = array ('h', 'o',
'm', 'e'); With the case changing (ie H would become h and U
would become u ) EDIT: Okay found out that I could change the case with
array_change_key_case ($nav_item, CASE_LOWER); ....
Looking for passing, values
|
|
Searching Video's for passing, values
|
advertisement
|
|