Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Assign Value On Click


is there a way to change the value of a variable when a hyperlink is clicked? like im include()ing a variable $content. and when you click it changes from URL to links or whatever?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Cannot Re-assign $this ...
I'm one more guy having the cannot re-assign $this problem.

someone left a php4 file here containing the lines

|function linkbar()
|{
|if(func_num_args() == 1)
|{

|$this = func_get_arg(0);
|return;
}
...
|}

inside a php4 class definition. func_get_arg(0) in this case delivers
an object - working fine in php4. I struggled a bit with the &
referencing (while not really understanding it and the problem) but
gave up. how must I modify the code to get it to work in php5?

PHP 5 Re-assign $this PROBLEM
Just a quickie, in case it's been covered, like a million times or
something. I'm self taught, and thought I was being pretty clever when building a "messaging" class.

The idea was to abstract "html email", "text email" and "sms message" up a
layer into a "message". To get a message started, I call on something like this:

$msg = new Message("sms");
Message (which re-assigns the $this variable) then looks something like
this:

class Message{
var $message_hash;
var $message_path;//this can be changed, in case stuff is moved in future...
function ryan_Message($type=""){//starts the whole thing
switch($type){
case "html"://this means an html email
include_once("HtmlMessage.php");
$this = new HtmlMessage();
break;
case "text"://this means a text mail
include_once("TextMessage.php");
$this = new TextMessage();
break;
case "sms"://this means an sms message
include_once("SmsMessage.php");
$this = new SmsMessage();
break;
}// end switch
}// end function
}// end class

Each class has methods that are named the same, but act a little
differently, so, basically, I can use the same set of commands to compose a
message and send it, regardless of what type of message it is.

Things work fantastically under php4, but I know that when I swap over to
php5, it's going to throw a hissy fit, because reassigning $this is not
allowed.

Aside from going around the Message class, and just starting messages of a
particular type from scratch:

Is there some sort of cunning retro-fit I could do to the Message class, so
I don't have to trawl through thousands of lines of code?

Assign Value To Variable
Is there any way I can use a function to create a variable and assign
a value to it? I have a Perl script that returns some LDAP
information:

sn=Shore
givenname=Mike
logintime=20041008153445Z
logindisabled=FALSE

Instead of parsing this text and assigning the values, I was wondering
if a function exists where I can pass a variable name and a value, and
the variable would be created.

ie. somefunc("sn", "Shore")

Would create the variable $sn and assign the value "Shore" to it.

Assign Value To The Link
I am creating a order-online application. I create some links in my html file. And in my table that I created by mySQL, there are some fields including picture_id, picture_name. What I want is to assign the picture_id to the link so that the picture_name will be selected (using mySQL) when the link was clicked. Can someone tell me how to write PHP code to assign the picture_id to the link?

Assign A Number From 1 To 9
I was wondering how to assign a number from 1 to 9 to a $variable which is used by a random feature if random is possible in PHP ?

How Do You Assign A Various Number Of Variables?
I'm struggeling with a small search engine here. I'm trying to put everything together myself, but I have a problem.

I've made a small form where search-words can be entered. This string is put into a variable $search. Then I've split this string up in pieces using the SPLIT command. something like this:

list ($one, $two, $three) = split ('[ ]', $search);

This works very nicely, but there is only one small problem. I can't possibly know how many search words will be used. It could be only one, but it could very be 10 or more (although unlikely). I thought about creating 10 variables, and in case they use less, they are just blank, but then if I use a OR function between these empty variables, the complete database (MySQL by the way) is called for.

I don't know if you're getting the picture, but I want to know how I can assing a number of variables not knowing the amount in advance.

Assign Japanese String To Var
Following code contains japanese string that is assigned to variable
$str.
code
=============
<?php
$str = "$B%0%C%I%P%$%T%+%=(B";
?>
=========
When i am executing above program it gives me error as following.
Parse error: parse error, unexpected $ in
/var/www/html/bhavin/mohla1.2.2/b.php on line 3

Do anybody have solution for the above problem.
How can i assign above japanese string($B%0%C%I%P%$%T%+%=(B) to
variable without error.

Trying To Assign Number To Image..
I am working on a countdown script that will display the number of days to go to an event. I am after a graphical version. I have the code working that displays the amount of days to go to the event but I now want to display that number as a graphic.

Whats the way of parsing the varible with "19" in it to make up a graphic? I have graphics for digits 0 - 9 made. Do you use some sort of array?

Extract 5 Rows Assign Name
I want to extract the last 5 thumbnail names added into my products table and assign each one a variable, for example:

thumb0452 = '$thumb1'
thumb0234 = '$thumb2'
thumb0678 = '$thumb3'
thumb0876 = '$thumb4'
thumb0123 = '$thumb5'

I assume I would start with something like this: PHP Code:

How Can I Assign Output To A Variable?
I'm trying to send an email and would like to put the output of some of my script into the body of the email. Here's the part that needs to be executed: PHP Code:

Fatal Error: Cannot Re-assign $this
i am running a code created with php4 on a php5 engine and I am running into problems with the $this . In php4 its a variable and in php5 its a ref to a class object (if am right)

I get the following error in a class "Fatal error: Cannot re-assign $this in {path}" which is caused by this line "$this = new $db( $serv, $user, $pass, $dbName );"

How can i resolve this ?  am thinking of renaming $this to something like $this_var but then this is likely not to work.

Assign Table Value As A Session??
someone logs into my application - a login function runs from a pinc file.  What is suppose to happen is if the username and password match - it is suppose to assign a session to the username - which is being passed from form and to the first and last name which are in the table for the user.  Can I assign a session variable to value in a mysql table?  It does properly set the cookie I am assigning on the setCookie line but is is not setting any of the three sessions.  Here is the function I am using: Code:

Assign A Unique Idenifier
How do you assign a unique idenifier that i could save to my db to use later on in my script?

Assign Function To Class....
Is it possible to assign some functions to a of a class?

class loginClass {
      function initialize() {$something}
}

function CheckLogin() {
      $something
}

$login = new loginClass();
$login->onLogin = CheckLogin();
$login->initialize();


where the CheckLogin function will only be run during the initialize of the class, not during loading of the whole document.

Is It Possible To Assign A Whole Function Or Block To A Variable ???
Is it possible to assign a whole function or block to a variable ???

eg.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<? if (db_num_rows($qid_p) == 0) { ?>
<li>No
<? } ?>
<? while ($prod = db_fetch_object($qid_p)) { ?>
<p><b><a href="product_details.php?id=<?=$prod->id?>"><? pv($prod->name) ?></a></b>
<br><? pv($prod->description) ?>
<br>$<? pv($prod->price) ?>
<br>[<a href="cart_add.php?id=<?=$prod->id?>">+ Add to Cart</a>]
<? } ?>

How to assign this code to a unique variable ???

Assign Function Output To Variable??
I've found some references to this topic at :
http://forums.devshed.com/showthrea...ion+to+variable
but it does not seem to be working for me.

here's a snippet...

<? PHP
function listPeople ($getArray)
{
foreach ( $getArray as $val )
{
echo "$val, ";
}
}

$foo = listPeople($splitDirector);
?>

The function works, and as you can see i'm simply trying to assign the output of the function to $foo. But instead, the output is written to the page where I assign it... like a print or echo statement, and the variable $foo is empty.

Fatal Error: Cannot Use Assign-op Operators
Getting the following error message:

"Fatal error: Cannot use assign-op operators with overloaded objects nor string offsets"

The PHP file includes one rather substantial array. I tried taking a few lines out of it just in case the sheer size of the array was giving me prolems, but this made no difference. PHP Code:

How Do We Assign 16 Bytes Unsigned Integer In PHP?
We are unable to represent an unsigned integer with 16 bytes memory
size. The current integer size is 4 bytes by default. There is no way
for us to store large integer in this case.

The valid number range is from 0 to 2^128-1
(340282366920938463463374607431768211455).



Ways To Assign A Value To A Session Variable.
I am wandering which way to assign a value to a session variable
exist. Which of the following examples will work.

Example #1:
session_start();
session_register("ex");
$ex = 2.0;
Example #2:
In first.php:
session_start();
session_register("ex");
In second.php:
$ex = 2.0;
Example #3:
In first.php:
session_start();...

Assign Variable From Database Field
Is there a way to assign a variable from a database field? I'm thinking along the lines of

$make = $row_rsList['make'];
$model = $row_rsList['model'];

then they'll switch out based on my SQL WHERE statement. This valid syntax?

How To Assign Data In A Table Field To A Variable
what exactly do i do to only retrieve information from a table and assign it to a variable? I don't want to manipulate the data in any way, just display it on the page.

Assign MySQL Function Result To PHP Variable
I know to use: mysql_fetch_row($result) to convert a row from a SQL query result set into an array for use with PHP. but in the case of SQL queries that return one value, such as calls to MySQL functions, is there another PHP mysql api function I should use.

For example, right now I use a "workaround" technique from PHPBuilder:
$result=mysql_query("SELECT COUNT(*) FROM tablename");
list($numrows)=mysql_fetch_row($result);

Rather than using this "workaround" code is there a way to simply assign the result of the MySQL function query to a variable.

$result=mysql_query("SELECT COUNT(*) FROM tablename");
$numrows=mysteryfunction($result);

Assign Variable To A Block Of Html Code
Is it possible to assign variable to a block of html code?
Something like this :

$myblokvar = "<table width="487" border="0" cellspacing="0" cellpadding="0">
<tr> <td><table width="487" border="0" cellspacing="0" cellpadding="0">
<tr> <td><img src="images/bartitle_login.gif " alt="Login" width="475"...

Assign Mysql Record Values To Gloabl Variabel
I've been struggle with the code below.
I've tried mysql_fetch_assoc and various other functions, but can't
seem to get it to work.
The code works as far as that point though.

global $first_name;
global $last_name;
global $password;

function get_acct_rec($email){

$conn = db_connect(HOST, USER, PASS, DB, PORT);

$sql = "SELECT * FROM `clients` WHERE `email` = '" . $email . "'";

$c_result = mysql_query($sql, $conn) or die("Failed to execute query
at line " . __LINE__ . ": " . db_error($conn));

while ($row = mysql_fetch_assoc($c_result)) {
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$password = $row['password'];
echo $row['first_name'];
}

mysql_free_result($result);

db_close($conn);

}

Click Counting
I have a links directory that I would like to count the number of times a link is clicked.

I currently have all the links being displayed by pulling the links data from a MySQL table. I have added the a 'Count' field to the existing table. The table contains the following fields: LinkID, Category, Name, URL, Description, Count.

My question is is it possible to count the clicks once the links data has been printed to HTML? I am thinking of the PHP equivalent of OnClick Count = Count + 1. Or have I got the whole logic back to front?

Set Vars On Click
I just wonder if itspossible to set an var when u click on a link. For example: When i click on www.test.com i want to make $test contain something.

Click Tracking
I have a portal where people advertise and on they are allowed to display their website addresses so that people that visit the site can go directly from their site from my site.

Do you know of a class or script that would be able to monitor when someone visits an advertisers site i.e. records the click as they go across to the advertisers website.

I could build this myself, but thought that there may be a class or script that would do this already. (Would like this to be stored on a MySQL database opposed to a text fil.

Banner Click Thru
I'm looking for an easy way to keep track of click thrus on a banner. Can anyone point me in the general direction of what I'd have to do code wise?

Click Counter
Anyone know about a script/code that count how many times a link have been clicked..
I have tried hotscripts.com, phpbank.net and so on.. Only found scripts that costs money or uses a MySQL database.

I need one with no needs for MySQL. It should look like something like this: [ Download ] Been downloaded (NUMBER) times.Anyone know about a simple script to do that?

Check Click
I have a page and a sponsor. Every time a user click on a banner from our
sponsor their webpage is opened. I'd like to reward these users, but how to
check who clicked on a banner. I can't do anything on sponsor's webpage?

Click Counter
i want to make a link counter, i mean, when somebody click on a link in my web, this click is archives. Code:

Single Click Downloads
How do I ptogram with PHP a link that when clicked starts downloading the file? Basically I dont want to link directly as I want to take note of the number of times a file is downloaded so I need some way of sending the file back to the browser after I have done some housekeeping.

Any Way To Remove Referring URL From A Click-thru?
Is there anyway to make a pass-through php file that will clear the referring URL, so the target site does not know where you came from?

Disable Right Click In Opera
In my website there is requirement to disable rightclick.
I am providing the code and it is working in I.E ,Netscape and
Mozilla.But not working in Opera browser.
My code is
<body oncontextmenu='return false;'>
The above single line code is working very fine in the above browsers
not in Opera.

MySql Dump On A Click
I am developing a system, in which user or power user is allowed to take the database backup, is there ne procedure, in which, on just click,,, the dump of mysql is created for backup.

Inserting Into Two Tables At One Click
I want to insert some data into 2 of my tables through my PHP form.How can i do it?
For example, field1, field2 should be inserted into table 1 and field3, field4 should be inserted into table 2. I'm able to insert into one table but not into 2 tables simultaneously.

Link Click Detection?
How might one detect if someone clicked on a hyperkink at your website,
so it can be logged in a database? This would have to be done before
the browser redirects.

Referrer/click Tracking?
Anyone know of a good referrer/click tracker program? I've checked hotscripts.com, freshmeat.net, and php.resourceindex.com but didn't find anything all that great. There seem to be a ton of programs to track outgoing links, but I was looking for something that is used to track incoming links to my site (i.e. if I put a link up on some site it would go to something like http://example.com/click.php?id=1 then I would know how many people came to my site through that one).

I don't need to know how to make one of these, that's easy, but I'm too busy to be reinventing the wheel right now.

User Feedback In One Click
I have seen this on google and MSN. Google groups has star on which if
you click the topic becomes stared... MSN has 5 stars to get feedback
from user for giving rank to the pages. Sorry I don't remember on which
page they have this feature but I am very sure they have this.

I also require it for page rank, I was wondering how do they do it. I
am sure MSN is not storing the data on the clients machine.

I want if users click on 3rd stat then the 3 should go inside my mySql
DB and at the same time I don't want them to go to some other page or
open a pop up or something,

Where Do They Go? How Can I Gather Click Info In PHP
I was wondering if it is possible to find out what people click on, using
PHP.

For example, I have a PHP page with an email link and some third party links
(e.g. www.someone-else.com). I want to know where people go.

My own solution would be to make the link not to an email or a third-party
website, but to another page along the lines of

<?php
//check out where it came from and where it is going
//write info to database
header = {where it should be going}

?>

I am not sure if you can do this with email, but I am also wondering if
there is an easier/smarter way to do this.

Click To Send This By Email
In this forum there is a option called click here to send this to a friend by email, I want to know how they pass the url to a different page?

Right-click Menu Change
Is there a possibility to change/define what will appear in menu after
right-clicking on text input box ?
If not - how to do this ?



Detect Mouse Click
Is it possible to detect where on a page someone clicks with PHP? If so, can you point me in the right direction?

Form Button Click Itself.
is it possible that  on a php script that i can make the form button click itself.

so i have a button that when a certain argument happens i want to click on itself thus resetting itself and doing the php script associated with the button being clicked the php is on a form on php self.  know it sounds strange but i have some coding that needs to reset itself and only does that when the button is clicked just want a work around. failing that is it possible to use jave to achive this.

Find New Record On Click
I want to make a next and a previous link with my data. here is my query:

<?php $sql = "SELECT DISTINCT pdp.PackageId, p.PackageType 
                            FROM productpackaging pdp, packaging p 
                            WHERE pdp.ProductId =2 
                            AND pdp.PackageId = p.PackageId";
$result = mysql_query($sql);

How do I write the code to get next or get previous??

Php Insert Into A Textbox On Click
I have a textbox, where a user can write out a newsletter type deal.

I also have a list of products, that when the user click on it, it grabs all the info from the database and neatly generates html for the product.

I can deal with grabbing from the database and formatting, but i need some help with on click insert into the text box.

Refresh The Page On Click
I'm trying to find a way to refresh the page upon the clicking of a link that does not use header's.

reason being there isnt anyway i can get the statement up above all the output.

The only way ive found of doing something similar is:

<META HTTP-EQUIV=Refresh CONTENT="3; mypage.php">
Which just refreshes the page every 3 seconds.

Not really suitable to be honest.

Can anyone think of another way to handle this?

Disable Right-click On Mouse
Is there a php script that wil disable the right-click on mouse or maybe disable the copy and paste feature of the browser?

because i have a client, wherein he wants to prevent public viewing his website from copying his website content?

Left Mouse Click To Download
I need to allow user to download, ex: a movie file, using left mouse click. How can I do it?


Copyright © 2005-08 www.BigResource.com, All rights reserved