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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





$PHP_SELF - Create A Link Which Refreshes The Current Page, And Based On Certain Items On The Page


On a page, I want to create a link which refreshes the current page, and based on certain items on the page (simple form objects like radio buttons)the page will load differently. My link looks like this: PHP Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Login Refreshes Current Page
Currently, when a user logs into my site, they are directed to a specific page upon success. Now that I have added some depth to my site, I want users to be able to login from any page, and when the login program executes, they are brought back to same page they were at, but in a logged in state. Code:

View Replies !
Highlight Certain Items On A Page Depending On Incoming Link
A PHP solution to the challenge was eventually developed by participants
that suited the original poster's needs brilliantly. My needs are somewhat
similar. I have a page of links (something like a big site map) several
times larger than the advert page at the center of the thread above (it
cannot be split into smaller pages). Code:

View Replies !
Current Page Pagination Link
When you use pagination, how do you disable the link for the current page you are on?Example:

<a >1</a> |
<a href="pagination.php?pg=2>2</a> |
<a href="pagination.php?pg=3>3</a>

I think you would use some type of php_self code to do this, but I am not sure.

View Replies !
Random Link Form Current Page
I have huge page of links, to whcih I am currently adding. I would
like to add a "random link" button which would parse the current page,
extract all URLs then load a random link.

View Replies !
Create Images From Within Current Page
I did a few searches but came up empty on this subject, although I may be blind. I know how to create an image and all that jazz ... but am having trouble figuring out how to generate the image on the fly (from inside a curent page) without it spitting out crap characters at me.

I know you need to use the header content type of image/png - but that makes my whole page just an output of the image, as expected. Code:

View Replies !
How To Create Dynamic Page From Link
I'm practicing to understand and learn and have the following example. My page displays the state with the pet names under them, like this: Code:

View Replies !
How To Prevent Page Refreshes
I am trying to come up with a method to prevent users from refreshing/reloading a page using PHP

I am making a PHP web based game. I don't want players to reload the page because it will reset the game -- this will be a way for them to cheat. It isn't a Flash game -- it's a pure PHP based combat system.

The best way I can think of this is to generate a random number and use that number for the combat instance. Store that number in a mySQL table and do a check to see if the number is the correct random number for the combat instance.

If the page reloads then a new random number is generated and the check fails, which doesn't allow the combat instance to display thereby preventing the player from cheating.

View Replies !
Login Script Just Refreshes The Page
i have a script but whenever I try to register a test user it just refreshes the page i need help finding the problem. PHP Code:

<?
if (strlen($_POST['username'])<1 || strlen($_POST['password'])<1 || strlen($_POST['passworda'])<1 || strlen($_POST['email'])<1)
{
    echo '<div align="center">Please enter your registration details.</div>'
}
elseif ($_POST['password'] != $_POST['passworda'])
{
    echo '<div align="center">Your passwords do not match.</div>'
}
elseif (strlen($_POST['username'])<4 || strlen($_POST['username'])>16 || strlen($_POST['password'])<4 || strlen($_POST['password'])>16 || strlen($_POST['passworda'])<4 || strlen($_POST['passworda'])>16)
{
    echo '<div align="center">Username and password must be between 4 and 16 characters.</div>'
.........................

View Replies !
Error Deleting Photo Once The Page Automatically Refreshes
I have some script that takes an album id and deletes that album and the specific photos in that album. The code does run. The problem is that an error message i set to echo appears saying error deleting photo once the page automatically refreshes. When i check the image folder the images actually have been deleted. Code:

View Replies !
Script Refreshes The Page When It Sees The User Isn't Logged In
Say I have a page named secret.php and I want only logged in users to access it, how can I stop others from briefly viewing it (my script refreshes the page when it sees the user isn't logged in, so they see it for a split second).

View Replies !
It Wont Delete The Entry From The Database. The Page Just Refreshes?
It wont delete the entry from the database. The page just refreshes? Code:

View Replies !
Pagination :: 5 Page Numbers On Both Sides Of The Current Page
I want to put a pagination on bottom of the page and I have like 100 page numbers or more, so I want to show only 5 page numbers on both sides of the current page, if u know what i mean like:

Prev .. 8 9 10 11 12 13 14 15 16 17 .. Next

when i move to the right or left then i add or subtract one. Here 's what i have so far:

for ($i = 1; $i <= $numPages; $i++) {
        echo " ";
        if ($i == $pageNum)
            echo "$i";
        else
            echo "<a href="?page=$i">$i</a>";
 }

View Replies !
Page Redirection - Link Index.html Page To A .php Pag
I have an index.html page with a link to a .php page This is the complete code of the .php page Code:

View Replies !
Refferring Page And Current Page?
I can't find a var that contains the referring page (I've looked on PHP.net and in several
books)...there is one in ASP, so I am assuming there is one in PHP, too. And, I would like to test for the current page so that I can modify my menu and footer depending on the currently loaded page...is there a var that reveals this?

View Replies !
How To Direct The Current Page To Another Page ?
I want to direct the current page to another page once users click the form submit button. Is there a PHP function that allows me to pass in a URL for this purpose?

View Replies !
Url - Create A Link Which Will Call The Page Again But Without The Querystring "?id=1".
I have a problem. For example, the current url of my webpage is

//localhost/learn/page1.php?id=1

I want to create a link which will call the page again but without the querystring "?id=1". I just want "//localhost/learn/page1.php". I have used $_SERVER['PHP_SELF'] but it is not correct. What should I do?

View Replies !
Setup A Link In My Page That Will Change My Page
I am working on a page with a right column that I want to use for
navigation. In this right column I am using the below code to set a
value for the link. I am using the variable $test right now.

I want to click on the link and when the value is set to a certain
value, say 1, I want the script to run and load a page based on a
switch case. This way I can use different links for navigation that
will load different forms and areas of my application. So here is the
code for the link line. Code:

View Replies !
Create A Page That Will Eliminate Everything Between The < Script > Tags On A Page
I have been trying to create a page that will eliminate everything between the < script > tags on a page and then render all the HTML that is leftover. For some reason, the page won't load for me, but when I copy the source, paste it in a text editor, manually delete all the JavaScript, and then just render what is left over, it works fine.

I have an error and I don't know why I'm getting this error. I don't know what is incorrect about the code.

QuoteParse error: parse error, unexpected ':', expecting ']' in /fantasypoints.php on line 25 Code:

View Replies !
PHP_SELF On Different Page?
I currently have the form results and inputted string displaying on the same page using:

<form method="post" action="<?php echo $_SERVER['$PHP_SELF']; ?>" name="form1" onSubmit="return validate(this);">

but I want to show the results and the inputted string on a different page, how do I do this?

View Replies !
Php Page Will Not Process Link To Different Page
I have just installed RH Linux ES 3.0 (basic) kernel 2.4.21-9.EL, i686,
Apache 2.0.X, and php 4.2.X. I have made no changes to the php.ini.

I am trying to use the following page (code listed here) to click on
link, and display 1 of three pages. The code does not seem to work, it
only shows the "else" condition of the php code, which is page:
"stuff.php". What do I need to do to my apache/php config to get this
to work? Of course I copied this code from a php site tutorial somewhere.

Page code below:
<?
if ($link == page2){
$page="files/page2.html";
}
elseif($link == page3){
$page="files/page3.html";
}
else{
$page="files/stuff.php";
}
?>
<html>
<head>
<title> index.php </title>
</head>
<body bgcolor="#999999">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="3"><h1>The Template (index.html)</h1></td>
</tr>
<tr>
<td align="center" valign="top"><a href="index.php?link=index">
Page 1 </a></td>
<td align="center" valign="top"><a href="index.php?link=page2">
Page 2 </a></td>
<td align="center" valign="top"><a href="index.php?link=page3">
Page 3 </a></td>
</tr>
</table>
<? include($page); ?>
</body>
</html>

View Replies !
Layout Items At One Page
I am looking for a neat and best practice way to layout a number of items (say, no more than 16 records) in one page, fill in a 4x4 grid. The most clear way is using <tableto display HTML. But the number of records is variable, so how i can program to render HTML code correctly?

For example, if we have 5 records, it should appear 4 items at first row, and 1 item at second row. so on. I am new to PHP and PHP template, so i wanna start from this point to get more understand of PHP. I have also read book <Programming PHPbut
there is no obvious answer of this.

$result = mysql_query ("SELECT * FROM item", $connection);
........

View Replies !
I Want To Create Something Like AMAZON: Those Who Liked Page A Also Liked Page B
I want to create something like AMAZON: those who liked page A also liked
page B (I am going to apply the concept to a few different selections, but
to keep it simple I will talk about page popularity here - like AMAZON talks
about purchase patterns: those who bought A also bought B, C and D).

In my mysql table, I record everytime a visitor looks at a particular page
(I keep track of people with sessions and they can only look at a page
once).

Next, what I want to do is to show a small list of similar likes. That is,
people who had an interest in page A also had an interest in page B.

The structure of my table is:
id
timestamp
session_id
page_name

There is a unique index on the combination of session_id and page_name.

To work out similar likes for page X, my idea was to make an array of all
the session ids that looked at page X and then select the top 10 of pages
that these folk looked at.

My question is, should I do this in PHP with a bunch of arrays, adding total
counts while looping through an array or shall I use SQL statements. I
could even make a really long string of WHERE session_id = A or session_id =
B, etc..... Although this seems really inefficient.

Another question I have is whether you think this will be a self-fulfilling
prophecy (e.g. if you say that page Y is also popular then people will check
it out and therefore make it more popular).

View Replies !
Error: This Page Contains Nonsecure Items
Every time I load the following page I get the "This page contains nonsecure items" "Would you like to display the none secure items?" I have clicked No to look for the nonsecure bits expecting them to be missing and nothing is missing. I ahve also looked at the source code and I just cannot work it out.

View Replies !
SSL Error Pop Up - Page Contains Both Secure And Nonsecure Items
I recently took over a site written in PHP. We utilize a third party
to perform a job match, search, and application. When this page loads
in IE, we get a pop up that says:

The Page contains both secure and nonsecure items. Do you want to display the nonsecure items? How can I get rid of this as people going to fill this application out...

View Replies !
How Can I Get URL Of Current Page
I went through and searched the PHP manual, and didnt find what i was looking for. I am a PHP newby obviously. On to my question, I was just curious, is there a php variable that calls on the URL currently in the address bar? I am writing a php script to redirect a user, depending on what domain the page was accessed from. Any assistence would be GREATLY appreciated!

View Replies !
Getting And Using Current Page URL
could some1 please help me withg etting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as follows: Code:

View Replies !
Get URL Of Current Page?
Is there a way using PHP to get the full URL of the current page and store it in a variable?

View Replies !
Current Page
HTML Code:

<tr align="left">
<td><a class="mainlevel" href="population_common.php" <?php if($_SERVER['PHP_SELF'] == "/zeus/population_common.php") echo ' id="active_menu"' ?>>Population</a></td>
</tr>

PHP Code:

elseif($_SERVER['PHP_SELF'] == "/zeus/population_elite.php")

View Replies !
Getting Current URL And $PHP_SELF
if the current url is index.php?type=news&id=3

$PHP_SELF will only give me index.php.

Is there any way of getting the rest? (?type=news&id=3)

View Replies !
Email Current Page
How do I "email this page" using php?

View Replies !
Emailing The Current Page
I now have a client who wants the facility for visitors to email a page
to friends. He doesn't want the link emailing, he wants the page
emailing "because people prefer that" - well, certainly not the people I
know, but he is paying... And I don't see the sense in this, because he
could end up sending code out that can't be interpreted by the mail
client.

As I don't use HTML email, can I ask - is there a way to get the page to
show automatically via a link, without the client clicking on it?

View Replies !
Page Doesn't Refresh To Current One
I have a comment/feedback section to my website.  After a person enters their comment and submits it I was hoping to have it refresh the page with the current page and their comments now displayed, but it is redirecting me to another page that I include. Code:

View Replies !
Current Page Is Secure
What's the code for if current page is secure. I can do it in JavaScript but I'm not that good at PHP. Here's the JavaScript

var current_page = location.href;
var current_page_is_secure = (current_page.indexOf("https://")>-1) ? true: false;

I assume it's similar in PHP.

View Replies !
Remembering Current Page
I have a page entitled: show_abstract.php?Abstract_ID=1 which has a link to show_author.php?Author_ID=5

Now if user follows the link, he is redirected to show_author.php?Author_ID=5.
If he updates the page by pressing the 'update' or 'cancel' button, I want him to be redirected to the page entitled: show_abstract.php?Abstract_ID=1

Now, how should I handle this, with a $_SESSION variable storing the current page link? or is there another smarter way of doing this?

View Replies !
Displaying The Current URL / Page
To insert the full URL of a current page (this is for a shopping cart "return URL"), I was using this:

<? echo "$SERVER_NAME$PHP_SELF" ?>

This worked fine on my old hosting server (PHP Version 4.1.2). Then I changed my hosting server (PHP Version 4.3.11) and suddenly it wouldn't work. But now I find this works:

<? echo 'http://www.'.$HTTP_SERVER_VARS["SERVER_NAME"].$PHP_SELF.$_SERVER['REQUEST_URI']; ?>

As a PHP newbie I suspect both are suspect.. Is there a way of doing this that I should get into the habit of using?

View Replies !
Refresh In Current Page
How to force a refresh in current page? Appreciate it if someone can show me the code. Reason: I have a page that allows user to change an image file. The image file is updated in the file directory. However, the 'old' image still shows in the current browser. The image will be updated only when I do a 'refresh' on the page.

View Replies !
Posting To The Current Page
Is it possible to post a value to the current page and display it when the page reloads?. For example if I am on 'page1.php' and usign a form to post a variable to 'page1.php', would this be possible. Possible code below: Any other suggestions if this wouldn't work? This is code for page1. php

<?php
echo $_POST['selection'];
?>
<form action="page1.php" method="post">
<select size=1 name="selection" onchange="this.form.submit();">
<option value="goalkeeper">Goalkeeper</option>
</select>
</form>

View Replies !
Php_self - Value Of The Current Script
I know PHP_SELF contains the value of the current script thats running, my question is, say i have example.php and inside that file i have. PHP Code:

<?php
include "form.php";
?>

where the form.php is a form who's action is PHP_SELF, now is PHP_SELF set to example.php or is it form.php?

View Replies !
Printable Verion Of The Current Page>?
How can u make a script which will make the current page a printable one with out me having to make a printable verion of each oage. That would be had if the amount of pages are 100+.

View Replies !
Causes For $_SESSION To Be Only Visible To Current Page?
I am working with PHP 4.3.8, Linux, and Apache 1.3.31 on a third-level or
sub domain.

The following code will diplay foo, session_id(), and increment count over
refreshes:

<?php
session_start();
$_SESSION['foo'] = 'bar'
$_SESSION['count']++;
print_r($_SESSION);
echo session_id();
?>
<a href="/test2.php">Next Page</a>

But using the link to go to test2.php shows $_SESSION as undefined, not even
an empty array.

<?php
print_r($_SESSION);
echo 'Foo is registered? ' . session_is_registered('foo');
echo session_id();
?>

View Replies !
Grab URL Of The Current Page And Put In Into A Variable?
Is it possible to use PHP to grab URL of the current page and put in into a variable?

ie. If I'm viewing:
http://localhost/mypage/index?article=23

Can I put "http://localhost/mypage/index?article=23" into a variable?

View Replies !
Very Strange ... Reloading Doesn't Get Current Version Of Page
Very frustrated by a quirk in a normal html form submission (a search box).

First it was getting no $_POST vars, though I checked the form method,
and used print_r($_POST) to see. Eventually I realized that when I
refreshed the browser it would not really refresh.

For example I put in a phpinfo() call just to make sure I was editing
the right search.php -- I refreshed and got the good old phpinfo. then I
commented that line out. I refreshed and got the good old phpinfo
anyway. I deleted the line entirely and still get it.

So it's getting a cached version from somewhere... I can't imagine
where; I've been building sites on this box for over a year and this is
the first time I've seen anything like this.

View Replies !
How To Pass Current POST Data To Next Page ?
I got 2 php pages, called A.php and B.php.

A.php will display all the selected records to the user and ask for confirmation before any attempt to delete. Let say the user click on the submit button, the action of the form is pointed to B.php.

So my problem is, how can I pass all the current POST data in A.php to B.php as well ?
I need that cauz the POST data in A.php contains the data needed like ID, to perform the deletion.

I can manually write a VBScript to transfer the existing data into a query string and transfer it to the next page. However, it's not a POST data in nature. It wil become GET data right ? So what should I do ?

View Replies !
Preg_Match Source Code On Current Page
The problem is that if I set the variable $page_check to a file on our server to test it, every thing works as it should.

But then when I place the script in a template file where the $page_check variable is set to $phpself - when loading a page with the script on I get firefox giving me a download box to download the current page file.

So I figure I cant request a page to fopen a url which is the same url the script is on?

So my question is how do I set up this script so it looks at its own source code, does a preg_match to find out what section its in? Code:

View Replies !
Getting Current Page Info Into The Query String
I have a drop down list in a form, in a PHP page, the form is displayed via 'echo'.

The FORM ACTION tags looks like this:

echo "<CENTER><FORM NAME='choose_lib' METHOD='post' ACTION='viewpix.php?ctPos=360&ctWid=109&hsp=1&loc= XXX '>";

When the user selects a name from the drop down list, which is dynamic, how can I get that variable into that ACTION url where it currently says XXX ? All I can think of is that I am going to need an intermediate page, and that doesn't sound very efficient.

View Replies !
Download Protect Script Getting Contents Of Current Page
I'm half way through a custom built download protection script that does various things. However this is the bit that isn't working....

$name = 'file.txt'
$fulldownload = '/files/'.$name;

header('Content-Disposition: attachment; filename="'.$fulldownload.'"');
header('Cache-control: private');

Instead of linking straight to the file in questions it actually prints the current page (HTML) and puts it in the txt file to download.

View Replies !
Show The Current Time At The Resort On His Home Page.
I have a client who owns a resort in the Philippines. This client wants to show the current time at the resort on his home page. How would this be done with PHP? Is it some calculation based upon GMT? I think (I'll have to check) that the Philippines is +8 GMT...so is that what you'd have to do: create a snippet that grabs the current GMT and add "8" to it?

View Replies !
Page Based Upon Condition
I'm sure this question is really showing my "neophyte" status in php, but here goes: I've got a form that has a number of buttons. On submit, certain functions are called and, depending on which button was pressed, certain things are processed. So far, that part works fine. However, in two instances (add record and edit record) I want to display two different pages. This is where I'm having the problem. As you can see below in the code sample, if $buttonHit == Edit - I want to display edit_row.php; ELSE I want to display Add_row.php.

if ($buttonHit == 'Delete'){
deleteEntry($rowId);
} else if ($buttonHit == 'Edit') {
// LOAD EDIT_ROW.PHP;
} else {
// LOAD ADD_ROW.PHP;
}

Seemed straight forward enough to me at the outset, but I can't find the right .php function or syntax to get the job done.

View Replies !
Write An Sql Statement That Reads All Orderlines With The Current Session ID Into The Web Page Using Php
I am trying to write an sql statement that reads all orderlines with the current session ID into the web page using php... I have the following SQL statement:
$sql = "SELECT sel_item, sel_item_qty, sel_item_price, sel_item_totalprice, date_added, phpsessid from user_track where phpsessid = "$phpsessid""; This doesn't work. Has anyone got any suggestions... this is pretty urgent.

View Replies !
Redirecting To Page Based Upon Usename
Is there any tutorial or code where i can find the the information on how to redirect to a page depending upon the user. For example

The first page has a form which contains username and password, after submit it is redirected to page base upon the username.

Such as if the user is john then it will direct to john.php or user joe will go to joe.php.

View Replies !
User Based Index Page
Both the users have same home page main.php.After logging with user1 only index1 page should be opened and with useer 2 only index2 page should be displayed. Code:

View Replies !
Change An Image Based On Landing Page - Possible?
I have 2 landing pages and I need to display a different contact phone number as an image for each page.

The thing that's got me thinking is that I need this image (which is in a standard header file) to stay the same for each visitor across all the pages on my site, depending on which landing page they came in from. I need the phone number image to stay the same for 30 minutes even if a user revisits one or more of the landing pages within that 30 minutes.

So is a visitor comes in from landingpage1 they see phonenumber1 throughout the site for 30mins - if a visitor comes in from landingpage2 they see phonenumber2 across the site for 30mins. What would be the best way to do this? php? javascript? would it need cookies?

View Replies !

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