[PHP] Clearing Post Data with IE

2004-03-22 Thread Chris Thomas
Hey,
Im writing a script for a poll, and im trying to figure out how to clear the
_post.
Right now  i post the response that the user selected from the poll, back to
the poll page, which then displays the results

The way it works right now, if i try to refresh the page, IE will pop a
dialog back asking me if i want to resubmit the post.

Is there a way to get it so that i can clear _post and get it so they arent
in the header??

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Clearing Post Data with IE

2004-03-23 Thread Chris Thomas
I tried using the Header('location: ') but it seems the posted data
follows the redirection
Im going from my main page to a processing page then back to my main page.
i printed $_POST on the main page and it still has the values that were
originally posted to the
processing page.  Also after the redirection the address in the address bar
is that of the processing page

Here is some code to help explain:

--index.php
print_r($_POST);
...
echo "";
echo "\n";
echo "\n";
foreach($poll->choices as $id => $choice) {
echo "id
>$choice->choice\n";
}
echo "";
echo "";


--poll.php
$poll_id = $_POST['poll_id'];
$poll_choice = $_POST['poll_choice'];
$calling = $_POST['calling'];

if (isset($poll_id)) {
unset($_POST);
Header("Location: $calling");
exit();
}


When poll.php loads up index.php the Posted data is still there.

Chris


"Chris Boget" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Is there a way to get it so that i can clear _post and get it so they
> arent
> > in the header??
>
> After you've finished all of the processing, just do:
>
> header( 'location: ' . $_SERVER['PHP_SELF'] );
> exit();
>
> Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Header Redirect & POST

2004-03-25 Thread Chris Thomas
I am not sure if this was designed like this, or if its just something im
doing wrong.

Im posting some data to a processing page, where i handle it then use
Header('Location: other.php') to direct me to another page.

The problem that im running into is that the posted data is available in
other.php.
I would like to get it so that in other.php $_POST  should be an empty array

Any suggestions??

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Header Redirect & POST

2004-03-25 Thread Chris Thomas

Here is a url with the problem that i was describing
http://xiot.darktech.org

I fiddled and I found what the problem.

Header('Location: $calling)  the first char in $calling can not be a
/
I was setting $calling with $_SERVER['PHP_SELF'] which adds the / in front
of the path.
I changed it to "." . $_SERVER['PHP_SELF'] and it worked

take a look at the url to see what was going on.

Here is the code that im using

--index.php
print_r($_POST);
...
echo "";
echo "\n";
echo "Choice 1";
echo "Choice 2";
echo "Choice 3";

echo "";
echo "";


--poll.php
$poll_id = $_POST['poll_id'];
$poll_choice = $_POST['poll_choice'];
$calling = $_POST['calling'];

if (isset($poll_id)) {
unset($_POST);
castVote($poll_id, $poll_choice);
    Header("Location: $calling");
exit();
}


Chris

"Jason Giangrande" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Chris Thomas wrote:
> > I am not sure if this was designed like this, or if its just something
im
> > doing wrong.
> >
> > Im posting some data to a processing page, where i handle it then use
> > Header('Location: other.php') to direct me to another page.
> >
> > The problem that im running into is that the posted data is available in
> > other.php.
> > I would like to get it so that in other.php $_POST  should be an empty
array
> >
> > Any suggestions??
> >
> > Chris
> >
>
> If the processing page and other.php page are two separate pages I don't
> see how you could be getting the same $_POST data that the processing
> page is receiving.  You aren't passing any data from your processing
> page to hidden form inputs (or something) on that page before you call
> header() are you?  Perhaps if you gave an example of your code I might
> have a better idea of what is going on.  You could also try using
> unset($_POST) in other.php to make sure $_POST is empty for that page.
>
> -- 
> Jason Giangrande <[EMAIL PROTECTED]>
> http://www.giangrande.org
> http://www.dogsiview.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] $_SESSION vs Database Call

2004-03-25 Thread Chris Thomas
Just wondering, what is faster / more effecient,  storing a value in the
session variable which gets stored on the filesystem (from what i
understand) or database calls to re-get the information?

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] sprintf troubles

2004-03-26 Thread Chris Thomas
Hey,
Im trying to use sprintf to format a number and left pad it with spaces, but
it doesnt want to add the spaces
I can pad it with anyother char using   sprintf("%'_8.2f, $val)  which will
left-pad the number with underscores

Has anyone had any luck padding with spaces??
or is there a better way to do this??

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Can't to insert data ( via variable ) into MS-SQL

2004-03-26 Thread Chris Thomas
Do you have register_globals on?
If not ayou have to get the POST information manually.
ie..  $job = $_POST['job']

Also are you sure that you are connecting to the database successfully?

add:
or die('could not connect')

to the end of your mssql_pconnect and mssql_select_db statements.

So your save.php should something like this.

Search data




Chris

<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Dear All,
>
> There is a sample that can't to insert any data ( via variable ) in
> MS-SQL :
>
> insert.php:
> 
> 
> 
> Job
> Subject
> 
> 
> 
> 
>
> save.php:
> Search data
> 
> 
>  $date=date('Y-m-d H:i:s');
> $link = mssql_pconnect("sql","sa","1234");
> mssql_select_db("phpbook",$link);
> $str = " INSERT INTO staff (name,job,subject)
> VALUES('$name','$job','$date','$subject',)";
> mssql_query($str,$link);
> ?>
>
> After insert data by using save.php, I found no any data from the
> Database system ( MS-SQL ), but I sure the Database System is no problem
> !
>
> So, how can I fix this kind of problem ( Sorry, I'm not familar with php
> ) ?
> Many thank for your help !
>
> Edward.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Relative Url

2004-04-01 Thread Chris Thomas
Is there anyway that i can get a url relative to my server for a script that
is being run??

The script is being included in mulitple files and $_SERVER['SCRIPT_NAME']
just gives me the name of the file that is including the other scripts.
Also $_SERVER['SCRIPT_FILENAME'] is returning nothing.

Thanks

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Relative Url

2004-04-02 Thread Chris Thomas
What im trying to do is this.

I working on creating a poll script, and right now it consists of 3 main
files:
poll.php   - Which does the server-side processing
pollFunctions.php   - Which draws the poll and does some client side stuff
poll.css- stylesheet
These files reside in the /poll directory (for now)

pollFunctions.php is included in the file that wants the poll, which may
reside in any folder.
So what im trying to figure out is the relative url of where the
pollfunctions.php file resides.

--  Now that i think about it i could just include the stylesheet from the
calling file (ie index.php)

I probally should have thought of this a little more before i posted...oh
well

Chris

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- Chris Thomas <[EMAIL PROTECTED]> wrote:
> > Is there anyway that i can get a url relative to my server for a
> > script that is being run??
>
> $relative_url = '/';
>
> That's a relative URL to your document root. What are you wanting,
> exactly?
>
> Chris
>
> =
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
>  Coming Fall 2004
> HTTP Developer's Handbook - Sams
>  http://httphandbook.org/
> PHP Community Site
>  http://phpcommunity.org/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php