homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Accessing form variables with PHP?
Trying to access form variables before a POST
CernyM




msg:1273509
 11:38 pm on Sep 19, 2003 (gmt 0)

I'm trying to access values set by form objects from within PHP right before they are sent off via post.

For example:

<FORM name="testform" method="post" action="http://foo.com">
<INPUT TYPE="hidden" name="userid" value="3005">
<INPUT TYPE="image" src="some_button.gif" name="submit" onClick="<?php

$body = "Userid = ".? what do I put here to get the value out of the userid form field?

mail("foo@bar.com", "Someone clicked a form!", $body, "From:bar@foo.com");

?>">

--Mike

 

mapostel




msg:1273510
 11:51 pm on Sep 19, 2003 (gmt 0)

Hi,

If I understand it right what you're trying to do, I'd say that it is not possible before the form gets submitted. The form values are on the client side whereas PHP is running on the server-side. Any processing would need to be done by the script specified in the ACTION attribute. But then it's no problem - just put the mail command in that script.

Hope it helps,

M.

CernyM




msg:1273511
 11:57 pm on Sep 19, 2003 (gmt 0)

I was afraid of that.

Unfortunately, I don't have control over the script in the action side, its being hosted by a third party.

Alternatively, could I call my own script or subroutine (even Javascript) and have it re-issue the post? I have no idea how to issue a post without a submit button though...

--Mike

jatar_k




msg:1273512
 5:50 am on Sep 20, 2003 (gmt 0)

Welcome to WebmasterWorld CernyM,

You could plug in your script as the action and then you have two choices

1. Make a confirmation screen. Email all you need to yourself and then have another submit button at the bottom to resub the info to the other script. Have a titla similar to "You ebtered this info please click submit to send it".

2. take a look at curl
[ca.php.net...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved