Current location: Hot Scripts Forums » Programming Languages » PHP » PHP help ! Submit the form


PHP help ! Submit the form

Reply
  #1 (permalink)  
Old 06-23-03, 01:11 AM
kevin kevin is offline
Newbie Coder
 
Join Date: Jun 2003
Location: USA
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
PHP help ! Submit the form

Hi !

This is my HTML code - file name "form.html"

Code:
<html><body>
<FORM method=POST action=script.php>
<input type=hidden name="abc" value="value_abc">
<input type=hidden name="def" value="value_def">
<input type=hidden name="xyz" value="value_xyz">
<input type=submit value=Submit>
</FORM>
</html></body>
I've wrote the "script.php" which can print to browser like this

abc|value_abc
def|value_def
xyz|value_xyz

This is what I have done - "script.php"

Code:
<?php
print "abc|$abc<br>def|$def<br>xyz|$xyz";
?>
And now - I need your help to write an advance "script.php"

I want that if I go to modify "form.html" -
change the field name "abc" to "new_abc" and new value for that field (see below)

<input type=hidden name="new_abc" value="new_value_abc">
<input type=hidden name="new_def" value="new_value_def">
<input type=hidden name="new_xyz" value="new_value_xyz">

Then when I submit the form - it will print out correctly like this

Code:
new_abc|new_value_abc
new_def|new_value_def
new_xyz|new_value_xyz
Hope you understand what I mean -

The "script.php" will print out correctly field_name|field_value even if I add or remove the form field.

Thanks
Reply With Quote
  #2 (permalink)  
Old 06-24-03, 08:09 AM
Chris Boulton Chris Boulton is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Sydney, Australia
Posts: 208
Thanks: 0
Thanked 0 Times in 0 Posts
This will only work if your form method is set to 'post'

PHP Code:

while(list($name,$val) = each($HTTP_POST_VARS)) {

 echo 
"$name|$val<br>";

If you want to use get, change $HTTP_POST_VARS to $HTTP_GET_VARS

Chris
__________________
Chris Boulton
SurfiOnline!
MyBulletinBoard
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why I always get \' and \" after I submit the form ! kevin PHP 4 11-24-03 04:57 AM
PHP Triad/Upload form eddyvlad PHP 6 10-06-03 11:17 PM
Need to submit form to database and text file - Any ideas how? dpreiss ASP 1 08-21-03 06:02 PM
What PHP Scripts Should I Be Using? HELP HELP!! pelican PHP 2 08-20-03 02:06 AM
php registration form al_ghamdi Script Requests 0 07-11-03 03:13 PM


All times are GMT -5. The time now is 08:21 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.