473,800 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in passing argument

52 New Member
HI again,


OK, now I have a page pictures.php
and I am using following code :
[PHP]printf("<a href=\"pictures .php?name=%s\"> ",urlencode($va l[0]));
print ("<img src=\"$val[0]\" width=100%)/></a>");[/PHP]

the problem is no value is stored in $name in pictures.php
I don't get anything when i print $name.

Need a help.
Thanks
Jan 1 '08 #1
11 1225
Markus
6,050 Recognized Expert Expert
There's no reference to '$name'

=/
Jan 1 '08 #2
shreedhan
52 New Member
There's no reference to '$name'

=/
I have included following line
[PHP]print ("$name");[/PHP]
in pictures.php
just after above code.

thanks
Jan 1 '08 #3
Markus
6,050 Recognized Expert Expert
$name is empty?

I'm really sorry, it's just i can't know what your code is.. you have to show me.
Jan 1 '08 #4
shreedhan
52 New Member
OK,
here is the code I'm using
[PHP]<?php
$loginid=$_SESS ION['loginid'];
mysql_connect(' localhost','use r','user');
mysql_select_db ('test');
$query="select name from pictures where loginid='$login id'";
$result=mysql_q uery($query);
print("<table width=95% align=center cellspacing=4> <tr>");
$count=0;
while($val=mysq l_fetch_array($ result))
{
if ($count++<5)
print("<td width=20%>");
else { print("</tr><tr><td width=20%>"); $count=0; }
printf("<a href=\"pictures .php?name=%s\"> ",urlencode($va l[0]));
print ("<img src=\"$val[0]\" width=100%)/></a>");
print("</td>");

}
if ($count<5)
while ($count++<5) print ("<td width=20%>&nbsp ;</td>");

print("</tr></table>");
print ("\n<br/><center><img src=\" $name \"><br/>");

?>[/PHP]

When I see the source code in my browser it doesn't show anything in place of $name in the last line

Thanks
Jan 2 '08 #5
rpnew
188 New Member
OK,
here is the code I'm using
[PHP]<?php
$loginid=$_SESS ION['loginid'];
mysql_connect(' localhost','use r','user');
mysql_select_db ('test');
$query="select name from pictures where loginid='$login id'";
$result=mysql_q uery($query);
print("<table width=95% align=center cellspacing=4> <tr>");
$count=0;
while($val=mysq l_fetch_array($ result))
{
if ($count++<5)
print("<td width=20%>");
else { print("</tr><tr><td width=20%>"); $count=0; }
printf("<a href=\"pictures .php?name=%s\"> ",urlencode($va l[0]));
print ("<img src=\"$val[0]\" width=100%)/></a>");
print("</td>");

}
if ($count<5)
while ($count++<5) print ("<td width=20%>&nbsp ;</td>");

print("</tr></table>");
print ("\n<br/><center><img src=\" $name \"><br/>");

?>[/PHP]

When I see the source code in my browser it doesn't show anything in place of $name in the last line

Thanks
Hi,

Well i didnt find any place in your code where you are assigning any value to '$name' so it will be empty..... what do you exactly want '$name' to print??

if i'm not understanding your code then let me know

Regards,
RP
Jan 2 '08 #6
shreedhan
52 New Member
Hi,

Well i didnt find any place in your code where you are assigning any value to '$name' so it will be empty..... what do you exactly want '$name' to print??

if i'm not understanding your code then let me know

Regards,
RP
Well, I think I should explain my code.

I am trying to make a page for pictures in which user will see thumnail-size pictures first. And when he clicks the picture, he will see the actual size of image later on the same page.

Ok, now I have included this code in line no. 14
[PHP]#
printf("<a href=\"pictures .php?name=%s\"> ",urlencode($va l[0]));[/PHP]

Isn't this suppose to assign value of urlencode($val[0]) to name ??
and when clicked in the link, isn't this code supposed to pass value of $name to pictures.php (which is the same page in my case).

So, I need the value of $name so as to know which image has the user clicked.

I think, that clears my problem and your doubt.

But please do help me
Thanks
Jan 2 '08 #7
Markus
6,050 Recognized Expert Expert
Have you tried printing just $val[0]?

Also, don't say $name.. it makes people look for a variable called $name in your script when it isnt there. You're just reffering to the name= in the url.
Jan 2 '08 #8
shreedhan
52 New Member
Hi,
thanks for your suggestions.

I have tried printing the value of $val[0] as well and it's working fine.
I can see in the page source as well as the url like pictures.php?na me=something but it seems name is not taking that value.
later when I include
[PHP]print ("\n<br/><center><img src=\" $name \"><br/>");[/PHP]
name doesn't have any value.

Thanks
Jan 3 '08 #9
Markus
6,050 Recognized Expert Expert
Are you using $_GET['name'];

To retrieve the name?
Jan 3 '08 #10

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

Similar topics

8
3969
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer http://alexvn.freeservers.com/s1/perfometer.html
25
2947
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default construction and then.. // some other processing and/or changing 'retval' return retval; }
6
2939
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd have better luck here. So here goes! My program ignores any command line arguments, or at least it's supposed to. However, when I pass any command line arguments to the program, the behaviour of one of the functions changes mysteriously. I have...
3
1779
by: Wild Wind | last post by:
Hello, I made a post relating to this issue a while back, but I haven't received any answer, so here I am again. I am writing a mixed C++ dll which uses the following declaration: typedef System::Byte ByteArray __gc;
39
19654
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1) What's the difference between these 3 statements: (i) memcpy(&b, &KoefD, n); // this works somewhere in my code
17
2336
by: Ashwin | last post by:
hi guys, i have overloaded the << operator.as shown below. ostream& operator<<(ostream &out, const student &a) { out<<a.idno; out<< " " ; // out<< a.name; out<< " " ; // out<< a.marks << endl;
0
1817
by: parekh | last post by:
Hi All , I am facing a problem wherein my VB project is not recognizing a change in the argument list of a method ( the method itself being declared and defined in another VC++ project and it is now updated to accept one more additional argument ). The problem in detail is as follows: I have a Class (named Student ) in an existing VC++ project. One of its Methods has the following signature and accepts 2 arguments ...
1
1977
by: User1014 | last post by:
Since you can pass a function to a ... erm...... function.... how to you use the result of a function as the argument for another function instead of passing the actual function to it. i.e. function foo2(){} function foo(func){}
11
3367
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible ways of passing an array. In the following code, fun1(int a1) - same as fun1(int* a1) - where both are of the type passed by reference. Inside this function, another pointer a1 is created whose address &a1 is different from that of the passed...
5
4564
by: fishwater00 | last post by:
I need to read parameters from a file called "params", the following is part of codes which can read parameters from that file. But I am not totally understand. Hope anyone can give detailed answers. Thanks. In a file called "params.c" #include "systems.h" /* it includes all .h codes I need */ int mystrcmp(const char *tag, char *buff) { int l = strlen(tag) ;
0
10507
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7582
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.