473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Program Error...?

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

----sample.php-----

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. ob_start();
  3. @session_start();
  4. require_once ("damn.php");
  5. createsessions(sex);
  6. ?>
  7. <html>
  8. <body>
  9. <form action="sample2.php" method="post">
  10. <input type="radio" name="sex" value="male" /> Male
  11. <br />
  12. <input type="radio" name="sex" value="female" /> Female
  13. <input type="submit" name="Submit"  value="Submit">
  14. </form>
  15. </body> 
  16. </html>
-------sample2.php-------

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.   $sex=$_SESSION[sex];
  3.   echo $sex;
  4. ?>
-------damn.php------

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. function createsessions($sex)
  3. {
  4.     session_register();
  5.     $_SESSION["sex"] = $sex;
  6. }
  7. ?>
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...
May 13 '10 #1
6 1233
Markus
6,050 Expert 4TB
You're going to need to compile the extension. What OS are you on?
May 13 '10 #2
niths
18
@Markus
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.
May 13 '10 #3
Markus
6,050 Expert 4TB
You be savvy to C programming, would you, i.e. have a compiler on your box (Visual Studio C++, or something like)?
May 13 '10 #4
niths
18
@Markus
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)
May 13 '10 #5
Markus
6,050 Expert 4TB
Whoa. For some reason, I posted this in the wrong thread. My bad. :)
May 13 '10 #6
Atli
5,058 Expert 4TB
@niths
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.
    Expand|Select|Wrap|Line Numbers
    1. // INCORRECT!
    2. $_SESSION[whatever] = "whatever";
    3.  
    4. // Correct
    5. $_SESSION["whatever"] = "whatever";
    Expand|Select|Wrap|Line Numbers
    1. // INCORRECT
    2. $something = something;
    3.  
    4. // Correct
    5. $something = "something";
    Expand|Select|Wrap|Line Numbers
    1. // INCORRECT!
    2. functionCall(something);
    3.  
    4. // Correct
    5. functionCall("something");
    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.
May 13 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Travis | last post by:
I have encountered a problem with ending any program I build with VB.net and was hopeing someone might have an answer. This is a simple example of the code that will cause an error: In a...
6
by: nyy | last post by:
I need help on this program, it have to convert cents to dollars when you enter #of cents. Thanks please anybody can help. Thanks.
14
by: tasheeta | last post by:
In my simple program I am getting this error..please help I am trying to find integers where 65537i + 3551j = 1 error: cannot convert `__complex__ int' to `long int' in assignment ...
1
by: MAL | last post by:
Hello, I have 2 classes that work great as a windows app to retrieve and process data from an Oracle9i db. When I implement them in a Service program running as Local System, it fails on the...
2
by: Brian Herbert Withun | last post by:
I'm having difficulty catching dbi.program-error which occurs this way: import dbi, odbc self.__cur.execute(sql) >>> dbi.program-error: Table 'depfile' not found in EXEC but
0
by: anaik100 | last post by:
am trying to run a java db2 program. my db2 is in os/390. below is the code public class T4DB2Connect { public static void main(String args) { try { // load the DB2 Driver...
3
by: BobAchgill | last post by:
I downloaded and tried to install my program on a Hebrew Windows Professional computer and got the error at start up of the program: Application has generated an exception that could not be...
3
by: Ron Jackson | last post by:
I am using Python 2.5 on Windows XP. I have installed Pyserial and win32all extensions. When I try to run the example program scan.py (included below), or any other program using pyserial, as...
2
by: ...:::JA:::... | last post by:
Hi, I using "Dev-C++", yesterday I was install Microsoft Visual Studio .NET 2003 I need it for building python extensions.Since I was install it when I write some program in Dev-C++ for...
2
by: Latina | last post by:
Hi I am doing a program overloaded operator. I am having a few errors on it. Error1: request for member `insertElement' in `S1set', which is of non- class type `IntegerSet' Error2: no matching...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.