Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Trying to pass a variable from a page to another
Old 01-09-2009, 03:58 AM Trying to pass a variable from a page to another
Average Talker

Posts: 20
Name: sadssa
Trades: 0
Hi,

im just trying to pass a variable from a page to another.

My problem:

im getting this error on the browser:

Code:
Code:
Not Found
The requested URL /red_social/mostrar_amigos.php was not found on this server.
These are the two pages:


PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><title></title>

<style type="text/css" media=all>

</style>
</head>

<body>


<?php

//Apuntador de enlace
$link=mysql_connect("localhost""root""") OR die(mysql_error()); 

//Asociacion de enlace con base de datos
mysql_select_db("red_social",$link) OR die(mysql_error()); 

//Maneja todas las variables string de las consultas con comillas sencillas e indicale al query la variable de enlace para saber sobre que base de datos apuntar
$result mysql_query("select * from amigos where email='$correo_electronico'",$link) OR die(mysql_error());  

// extraemos la primera fila de "amigos" y la pasamos a "$row".
$row mysql_fetch_array($result);


if(
$row["password"]==$contrasena)

{

?>


<span id="saludo">

<span id="hola">
Hola
</span>

<?php
echo $row["nombre"];
?>

<span id= "elige..."> 
elige una de las siguiente opciones:
</span>

</div>

<div id="mostrar...">



<a href="mostrar_amigos.php?correo= <?php echo $correo_electronico?> ">Mostrar amigos</a><br>
Mostrar compaņeros universidad<br>
Mostrar compaņeros trabajo<br>
Buscar entre los usuarios registrados<br>



</div>

<?php

}

?>


</body>

</html>

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><title></title>





</head>

<body>

<?php


//Apuntador de enlace
$link=mysql_connect("localhost""root""") OR die(mysql_error()); 

//Asociacion de enlace con base de datos
mysql_select_db("red_social",$link) OR die(mysql_error()); 

//Maneja todas las variables string de las consultas con comillas sencillas e indicale al query la variable de enlace para saber sobre que base de datos apuntar
$result mysql_query("select * from amigos where email='$correo_electronico'",$link) OR die(mysql_error());  

// extraemos la primera fila de "amigos" y la pasamos a "$row".
$row mysql_fetch_array($result);


if(
$row["password"]==$contrasena)
{

?>

<span id="saludo">

<span id="hola">
Hola
</span>

<?php
echo $row["nombre"];
?>


<span id= "estos..."> 
estos son tus amigos:
</span>

</div>


<?php


echo $_GET['correo'];

?>

</body>

</html>
Any idea?
tirengarfio is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-09-2009, 04:42 AM Re: Trying to pass a variable from a page to another
stoot98's Avatar
Ultra Talker

Posts: 427
Name: Stuart
Location: Glasgow, Scotland
Trades: 0
That doesnt look like a PHP problem - it looks like the page you are linking to doesnt exist!
stoot98 is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 05:10 AM Re: Trying to pass a variable from a page to another
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
You might have a problem in the path...
Take care of the case, if your server is linux/unix based.
A page named "mostrar_amigos.php" is not the same as "Mostrar_amigos.php".
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-09-2009, 05:13 AM Re: Trying to pass a variable from a page to another
Average Talker

Posts: 20
Name: sadssa
Trades: 0
Quote:
Originally Posted by stoot98 View Post
That doesnt look like a PHP problem - it looks like the page you are linking to doesnt exist!
I dont have any problem showing page (mostrar_amigos.php) when i delete the text which sends the variable (?correo= <?php echo $correo_electronico; ?>), so i think the page exists.
tirengarfio is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 05:16 AM Re: Trying to pass a variable from a page to another
Average Talker

Posts: 20
Name: sadssa
Trades: 0
Quote:
Originally Posted by tripy View Post
You might have a problem in the path...
Take care of the case, if your server is linux/unix based.
A page named "mostrar_amigos.php" is not the same as "Mostrar_amigos.php".

"Mostrar_amigos.php" is not written any place.
tirengarfio is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 05:34 AM Re: Trying to pass a variable from a page to another
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Originally Posted by tirengarfio View Post
"Mostrar_amigos.php" is not written any place.
It was an example that you might have your file named with a different case than you refer in your file.
I cannot see your hdd content, so I cannot tell.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-09-2009, 05:49 AM Re: Trying to pass a variable from a page to another
Average Talker

Posts: 20
Name: sadssa
Trades: 0
Quote:
Originally Posted by tripy View Post
It was an example that you might have your file named with a different case than you refer in your file.
I cannot see your hdd content, so I cannot tell.
In my hdd: "mostrar_amigos.php"
tirengarfio is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 06:02 AM Re: Trying to pass a variable from a page to another
jason_alan's Avatar
Super Talker

Posts: 100
Name: Jason
Location: Seattle, WA
Trades: 0
what's the url of the first page you're linking FROM? It looks to me like it is in the red_social folder and mostrar_amigos.php is not.
jason_alan is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 06:14 AM Re: Trying to pass a variable from a page to another
Average Talker

Posts: 20
Name: sadssa
Trades: 0
Quote:
Originally Posted by jason_alan View Post
what's the url of the first page you're linking FROM? It looks to me like it is in the red_social folder and mostrar_amigos.php is not.
This is the first code's path:

[root@andLinux red_social]# pwd comprobacion_logeado.php
/opt/lampp/htdocs/red_social

and this is second code's path:

[root@andLinux red_social]# pwd mostrar_amigos.php
/opt/lampp/htdocs/red_social
tirengarfio is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 06:36 AM Re: Trying to pass a variable from a page to another
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Ok. Then, are you sure that the apache root folder is /opt/lampp/htdocs/, and what are the permissions of the red_social folder ?
Usually, you must have the execution right for everybody on the folder for apache to access it, if it's not owned by the declared apache user.
do a
Code:
ls -la
in your htdocs folder to look at the red_social permissions.
They should looks something like this (an example from my own home server)
Code:
drwxrwxr-x  19 apache  webdev      4096 Nov 10 15:21 workspace
It's the 1st column that is important.
d means "directory", then it's 3 series of "rwx" meaning "read - write - execute".
The first series relate to the owner of the file (here: apache), the second to the members of the group (here: webdev), and the third is the permissions to everybody not in the 2 first cases.

In this case, apache user and members of the group webdev have full rights, and everybody else have execution and read rights only.
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 01-09-2009 at 06:41 AM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-09-2009, 07:07 AM Re: Trying to pass a variable from a page to another
Average Talker

Posts: 20
Name: sadssa
Trades: 0
Hi again,

i changed the permission of "mostrar_amigos.php" in this way:
Code:
sudo chmod 777 mostrar_amigos.php
and now it works ok.

Thanks!
tirengarfio is offline
Reply With Quote
View Public Profile
 
Old 01-09-2009, 08:27 AM Re: Trying to pass a variable from a page to another
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Good, I don't know why, but I've seen that the bit "execute" should always be set to true.
Just "read" is not sufficient to have apache accessing it.
Or it's on the folder, I quite don't remember exactly, but there is something about this "execute" bit.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-10-2009, 10:26 PM Re: Trying to pass a variable from a page to another
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
well, PHP files are executed, so that would make sense
__________________
Will Anderson

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Old 01-11-2009, 08:47 AM Re: Trying to pass a variable from a page to another
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Originally Posted by anderswc View Post
well, PHP files are executed, so that would make sense
Nope, not in the sense of a linux execution though.
PHP files are resources that are used to give instructions to the php interpreter.

If you try to do an
Code:
./myScript.php
from the terminal, you will get back:
Code:
./dmpOrders.php
./dmpOrders.php: line 1: ?php: No such file or directory
./dmpOrders.php: line 2: =: command not found
./dmpOrders.php: line 3: syntax error near unexpected token `('
./dmpOrders.php: line 3: `$db= pg_connect($conn_string);'
because the shell tries to interpret the script itself.

I know that the execute bit on a folder means "permission to list the content".
If you have the read right but not the execution right on a folder, then you are blind.
If you specify the path and that the file exists, it'll work. But you cannot see which files are in the folder.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-14-2009, 02:56 AM Re: Trying to pass a variable from a page to another
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
What I meant was that in a sense the PHP interpreter "executes" the instructions in the PHP file. I've always assumed that PHP only interprets files which have the executable flag set to true. So to "execute" a PHP file, you have to make it CHMOD executable.
__________________
Will Anderson

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Old 01-14-2009, 03:13 AM Re: Trying to pass a variable from a page to another
jason_alan's Avatar
Super Talker

Posts: 100
Name: Jason
Location: Seattle, WA
Trades: 0
Well, no, the php interpreter reads the php file (as instructions), to interpret into bytecode. and just needs "read" permission to do this
jason_alan is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Trying to pass a variable from a page to another
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.50939 seconds with 12 queries