Program Error…? – PHP



hi all,
i dont know what the error with this program.I cannot get the value.


require_once ("damn.php");
<form action="sample2.php" method="post">
<input type="radio" name="sex" value="male" /> Male
<br />
<input type="radio" name="sex" value="female" /> Female
<input type="submit" name="Submit" value="Submit">


echo $sex;


function createsessions($sex)
$_SESSION["sex"] = $sex;

wen i press submit button i am not getting the echo value i am not knowing wer the error is….? so can any one…?
thanks in advance…


You’re going to need to compile the extension. What OS are you on?



Windows XP Professional but why…?
Is the code i had writen is correct…? can we create session like that. can we call the session value like that….?
i dont know why it is not printing the value.


You be savvy to C programming, would you, i.e. have a compiler on your box (Visual Studio C++, or something like)?



sorry i dont understand wat ur saying..
why do we need that..?
u r asking wat compiler i am having right. i am using php debugger(Nusphere)


Whoa. For some reason, I posted this in the wrong thread. My bad. 🙂



There are a few problems with your code that you should fix before anything else.
First of all, as always when you are developing your code, you should turn on the error messages. Otherwise you are flying blind. Remove the @ from the session_start function. It’s rarely a good idea to suppress errors, especially errors relating to functions that would cripple your application when they fail. – If you want to hide the errors from your visitors, use the Error and Logging config directives to hide and/or re-route the error messages, but always keep them enabled in one way or another, and use them when you are debugging your code. (Use the ini_set function to change them, or simply change them in your php.ini file.) Always quote strings! PHP is smart (or dumb, depending on the perspective) enough to convert unquoted text into a string for you, but that’s no excuse.

$_SESSION[whatever] = "whatever";
// Correct
$_SESSION["whatever"] = "whatever";
$something = something;
// Correct
$something = "something";
// Correct

And so on… The session_register function is deprecated and should therefore be avoided. But even so, the way you use it in your code is not the right way. – Line #5 of your damn.php file is the right way to set a session variable. It’s best to just forget the session_register function altogether.
Try to fix that and see if you get anywhere. If not, post any error messages you get here and tell us exactly what is happening, or not happening.