| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | JavaScript and PHP Help 50np reward What im doing is trying to take a username var from javascript and post it to a php document in an inline frame. < HTML Code: form method="POST" action="edit.php" target="I2"><input type="hidden" name="usrname" value="javascript: document.getElementById('username').value"> <textarea rows="2" name="profile" cols="56"></textarea><br><input type="submit" value="Save Profile" name="B1"></form> <p> <iframe name="I2" width="294" height="28" src="edit.php" frameborder="0"></iframe> ????: NamePros.com http://www.namepros.com/programming/149527-javascript-and-php-help-50np-reward.html Im rewarding 50NP to the one that provides a solution that works
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | #2 (permalink) |
| NamePros Regular Join Date: Nov 2005
Posts: 383
![]() ![]() | Code: <script language="javascript">
var username = "Sjaguar13";
function inputUsername(obj){
obj.usrname.value = username;
return true;
}
</script>
<form method="POST" action="edit.php" target="I2" onSubmit="return inputUsername(this);">
<input type="hidden" name="usrname">
<textarea rows="2" name="profile" cols="56"></textarea>
<br>
<input type="submit" value="Save Profile" name="B1">
</form>
<p>
<iframe name="I2" width="294" height="28" src="edit.php" frameborder="0"></iframe> |
| |
| | THREAD STARTER #3 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | well the script im using already has the username defined... should i still use the function input username? and no usrname isnot a typo
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | #4 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | im not a javascript wiz, but doesnt this line: value="javascript: document.getElementById('username').value" need a semicolon in there somewhere? compared to all other javascript, it needs semicolons.
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |
| | #5 (permalink) | ||||||||
| NamePros Regular Join Date: Nov 2005
Posts: 383
![]() ![]() |
| ||||||||
| |
| | #6 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Hi. Can I just ask: - Is it completely necessary to use javascript? Cant you use PHP to store the variable? - Is it completely necessary to use an iframe? That a) causes problems in browsers that don't support iframes and b) causes problems in your script. I don't know what you are doing, but you could probably do a better job if you just used one language. Using two would be hard/complicated but trying to mix them is suicidal. There are always obstacles you could easilly get round if you just used one language. |
| |
| | #8 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Have you tried adding an "ID" att to the iframe? HTML Code: <iframe name="I2" id="I2" width="294" height="28" src="edit.php" frameborder="0"></iframe> |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Great Scripts for Sale With Resale Rights! | Zeeble | Scripts For Sale | 20 | 01-04-2006 02:39 AM |
| Javascript / PHP Question | Zubair1 | Programming | 4 | 08-20-2005 09:55 AM |
| How would I intergrate Javascript with php | -Ray- | Programming | 12 | 07-02-2005 01:10 AM |
| PHP & JavaScript | D@Z | Programming | 0 | 02-20-2005 03:49 PM |
| How I fill javascript array with php variables? | wiedzim | CODE | 0 | 03-31-2004 03:45 AM |