Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Kinda pointless project


ghost's Avatar
0 0

Well, i need help with a thing here:

Im making a little code here to list all supplied GET vars, althou i need some regex to remove some chars i dont want also need something that can place all data in an array

Source Code:

ob_start();
	print_r($_GET);
$postdata = ob_get_clean();
$postdata = eregi_replace("Array", "", $postdata);
$postdata = eregi_replace(">", "", $postdata);

Thx in advance


spyware's Avatar
Banned
0 0

What are the chars you don't want? Also, try to describe what your goal is in detail, please. I want to help you, but first I need you to help me understand this ;)


ghost's Avatar
0 0

Okay sorry, i was in a hurry :/

Okay so what i get now if i post it like: get.php?page=hi&?hi=hell is:

( [page] = hi [hi] = hello )

and i want to delete the ( and ) also i want the values to be like:

page = hi instead of [page] = hi

The goal with this project is that i want to make a form 2 get script…

Don't ask me why xD


ghost's Avatar
0 0

yeah well, i need something that can make it into an array aswell :/, or something that makes a line break after every value… I guess that could be accomplished witrh regex?


ghost's Avatar
0 0

Okay, so now i filtered away all ()[], but im thinking, is there a way to make it like an eregi("(.) = (.)", $postdata, $gets);

Cus then it will save all matches in an array the i can use a for loop to make a br after every get, anyone wanna gimme a hin on how to accomplish this?


ghost's Avatar
0 0

What about

foreach ( $_GET $name => $var ) { echo htmlspecialchars ( $name, ENT_QUOTES ) . " " . htmlspecialchars ( $var, ENT_QUOTES ) . "<br />"; }


ghost's Avatar
0 0

hmm,maybe,iltry that :P.. But my atual purpose is to learn a litle bit ore about regex :P But thx mozzer


ghost's Avatar
0 0

I don't see the point in trying to do something in a different way when a faster simpler way exists


ghost's Avatar
0 0

well,you got a point ther, well i will sue your method, but i will finishit off my way aswell, just because i wanna learn regex xD Thx spywareand mozzer for your help :)


spyware's Avatar
Banned
0 0

mozzer wrote: I don't see the point in trying to do something in a different way when a faster simpler way exists

Of course you do, just think about it. Why would someone take the hard way?


ghost's Avatar
0 0

Well, i just told you, i will use mozzers way, but i still wanna do the hard way because i want to learn something new :)