JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 3.50 average. Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 11th, 2000, 11:32 PM
Subramanian Subramanian is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 2 Subramanian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi
in an php form i want to take text filed value after cliking button(not submit button)
so,in button onclick event its call javascript function.but i want to value of text filed in php script
pl.help me


Reply With Quote
  #2  
Old July 12th, 2000, 03:03 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

<<
in an php form i want to take text filed value after cliking button(not submit button)
so,in button onclick event its call javascript function.but i want to value of text filed in php script
>>
[b]

Subramanian,

you can do that..but why you are using with out a submit button..

if you are using a java script for submitting your value to php then your program should be some thing like..

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function submit(){
document.formname.submit();
//i am not sure about above function..
// pls check it out in some java tutorial.
}
</SCRIPT>
</head>
<body>

<form name="formname" action="test.php3">

<input type="button" onClick="submit();">
</form>
</body>
</html>

------ ----- ----- ----- ----- -----

i would suggest you to use a submit button for submitting your form values to php program.becoz that would be safe other wise your javascript may give some problem in some old browsers..




------------------
[b]SR
-
webshiju.com

"The fear of the LORD is the beginning of knowledge..."

Reply With Quote
  #3  
Old July 12th, 2000, 08:01 AM
Sepodati's Avatar
Sepodati Sepodati is offline
Banned (not really)
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 1999
Location: Brussels, Belgium
Posts: 14,628 Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)Sepodati User rank is General 51st Grade (Above 100000 Reputation Level)  Folding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced Folder
Time spent in forums: 3 Months 6 Days 2 h 39 m 6 sec
Reputation Power: 4375
Send a message via ICQ to Sepodati Send a message via Yahoo to Sepodati
You have to eventually submit the form, either by form.submit() or by using a submit button, to get the hidden values to php. a submit button is easy, or you could use the onsubmit= handler to call a function.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
//********
//test.php
//********
<html>
<head><title>Test Page</title>
<script language="javascript">
function test_me()
{
document.myform.hidden1.value='value1';
document.myform.hidden2.value='value2';
document.myform.hidden3.value='value3';
}
</script>
</head>
<body>
<form method=post action=page3.php onsubmit="test_me();">
<input type=text name="fname">
<input type=text name="lname">
<?php
for ($count=1;$count<=3;$count++)
{
echo "<input type=hidden "name=hidden$count">
}
?>
<input type=submit name="submit" value="Submit Form">
</body>
</html>
[/code]

I just made that up, but hopefully it gives you some ideas. You can add if..then or while or whatever to the javascript function to do whatever you want to the form variable. say, maybe only make two hidden values if they don't give a first name...make 3 if they give both first and last, etc... it's up to whatever you are trying to do.

you can always change the submit button to something else, and then add the document.myform.submit() line to test_me(), like Shiju recommended.



---John Holmes...

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > How to take form filed value from javascript in php?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap