| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| An American Soldier ![]() | 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> Im rewarding 50NP to the one that provides a solution that works
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #2 (permalink) |
| NamePros Regular | 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>
|
| |
| | #3 (permalink) |
| An American Soldier ![]() | well the script im using already has the username defined... should i still use the function input username? and no usrname isnot a typo
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #4 (permalink) |
| Senior Member | 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 | Quote:
Quote:
| ||
| |
| | #6 (permalink) |
| Soon to be RICHdoggie! | 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! | 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 01:39 AM |
| Javascript / PHP Question | Zubair1 | Programming | 4 | 08-20-2005 08:55 AM |
| How would I intergrate Javascript with php | -Ray- | Programming | 12 | 07-02-2005 12:10 AM |
| PHP & JavaScript | D@Z | Programming | 0 | 02-20-2005 02:49 PM |
| How I fill javascript array with php variables? | wiedzim | CODE | 0 | 03-31-2004 02:45 AM |