|
-
May 27th, 2009, 07:37 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Pass Variables from One Page to Another
i m trying to pass variable from one page to another but this variable stay empty
here is my full code -
page.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>page</title>
</head>
<body>
<form name="form1" action="page1.php" method="post">
<input type="text" name="var1" value="">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
page1.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>page1</title>
</head>
<body>
<?
$variable_from_page = $_POST['var1'];
echo($variable_from_page);
?>
</body>
</html>
Last edited by samsyl; May 29th, 2009 at 05:56 PM.
-
May 27th, 2009, 08:43 AM
#2
Re: Pass Variables from One Page to Another
Chances are your shorttags aren't being parsed.
Replace <? with <?php
Example:
PHP Code:
<?php
//code goes here
?>
-
May 28th, 2009, 04:15 AM
#3
Thread Starter
Hyperactive Member
Re: Pass Variables from One Page to Another
Its not working too. I m using Apache 1.3 and PHP4. I cant understand wer is the mistake.
Thanks for help
-
May 28th, 2009, 06:47 AM
#4
Re: Pass Variables from One Page to Another
There is no error with the code, it works fine. If you run a page with just
PHP Code:
<?php echo phpinfo(); ?>
Does it work? It sounds like there may be issues with PHP in your apache install.
-
May 28th, 2009, 06:55 AM
#5
Thread Starter
Hyperactive Member
Re: Pass Variables from One Page to Another
i jst downloaded 'ZZEE PHP GUI' for test and code is working fine.
something wrong with my apache 1.3
do i need the latest apache?
-
May 28th, 2009, 09:35 AM
#6
Re: Pass Variables from One Page to Another
Apache doesn't seem to be the problem. Your web service is running fine or else the HTML wouldn't appear. You may need to install PHP or upgrade your service.
If you want to save yourself some trouble, I suggest just downloading WAMP for this kind of testing.
WAMP URL: http://www.wampserver.com/en/
-
May 29th, 2009, 05:52 PM
#7
Thread Starter
Hyperactive Member
Re: Pass Variables from One Page to Another
Its an excellent software. Everything working nicely. Thanks for help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|