php script "$GET"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting php script "$GET"
# 1  
Old 10-13-2012
php script "$GET"

Hi,

i have php script to show the page per row 10, the script working fine in windows. but when i try use in linux machine getting error.

"Notice: Undefined variable: halaman in /opt/lampp/htdocs/logistik/operator/paging/paging1.php on line 52"

PHP Code:
        //tentukan batas, cek halaman dan posisi data
        
$batas=10;
        
$halaman $_GET['halaman'];
        if (empty(
$halaman))
        {
                
$posisi=0;
                
$halaman=1;
        }
        else
        {
                
$posisi=($halaman-1) * $batas;
        } 

Last edited by Scrutinizer; 10-13-2012 at 12:53 PM.. Reason: php tags
# 2  
Old 10-13-2012
When I open the attachment, vi says "paging1.php" [dos] 133L, 3150C.

Perhaps your PHP or Apache, neither of which, for good reason, was developed on Windows is complaining about the carriage return?

And for a 3K attachment, please just include the whole code in the post, not an attachment. I don't want to download your code into my downloads folder every time you post it.

There's nothing wrong with the PHP itself.

Code:
$ php -l paging1.php 
No syntax errors detected in paging1.php
$ php ./paging1.php
Anda belum login$

# 3  
Old 10-13-2012
Thanks Scott, Anyway i use xampp for both machine. There is no complaining about the carriage return on windows. Its working perfect when show on page 1. But in linux machine its showing "undefined variable"

Im trying to translate the part of code
Code:
//show border, check page and position data
        $border=10;
        $page = $_GET['page'];
        if (empty($page))
        {
                $position=0;
                $page=1;
        }
        else
        {
                $position=($page-1) * $border;
        }  

Is there any other scripts to show the page per row 10?

Last edited by justbow; 10-13-2012 at 02:08 PM.. Reason: quote
# 4  
Old 10-13-2012
Try:
Code:
cp paging1.php paging1.php.bak
$ tr -d '\r' < paging1.php.bak > paging1.php

# 5  
Old 10-13-2012
Thanks Scott,

It's working fine now. I put @ on the GET

Code:
$page = @$_GET['page'];

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. UNIX for Dummies Questions & Answers

"Help with bash script" - "License Server and Patch Updates"

Hi All, I'm completely new to bash scripting and still learning my way through albeit vey slowly. I need to know where to insert my server names', my ip address numbers through out the script alas to no avail. I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Discussion started by: profileuser
25 Replies

5. Red Hat

files having Script which works behind "who" & "w" commands

Dear All, plz print the path of files which have the script of "who" & "w" commands. thnx in advance. (6 Replies)
Discussion started by: saqlain.bashir
6 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

Simplify Bash Script Using "sed" Or "awk"

Input file: 2 aux003.net3.com error12 6 awn0117.net1.com error13 84 aux008 error14 29 aux001.ha.ux.isd.com error12 209 aux002.vm.ux.isd.com error34 21 alx0027.vm.net2.com error12 227 dux001.net5.com error123 22 us008.dot.net2.com error121 13 us009.net2.com error129Expected Output: 2... (4 Replies)
Discussion started by: sQew
4 Replies

8. AIX

"too big" and "not enough memory" errors in shell script

Hi, This is odd, however here goes. There are several shell scripts that run in our production environment AIX 595 LPAR m/c, which has sufficient memory 14GB (physical memory) and horsepower 5CPUs. However from time to time we get the following errors in these shell scripts. The time when these... (11 Replies)
Discussion started by: jerardfjay
11 Replies

9. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question