• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Changing iframe from external form (SOLVED)

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Reaction score
10
Location
Mexico
SOLVED

I have a damage calculator on my ot's website, it's written on javascript. As soon as you type a number(onKeyUp), it already makes the calculations, so you don't need to press the submit button each time you change a value.

I want to make this calculator in PHP, but I want to make it instant too, I don't want the page to be reloaded when you click submit, I want submit to show the results right there.
So I was thinking in having a form send data to an iframe(using post). I know how to make links that target an iframe, but what I need is that when you click submit on the form, it's sends the data(magic level, lvl, etc) to the iframe, so I can make the math there.

For example:
I fill the form:
Level: 100
Magic Level: 40

It should target the iframe to.... "damagecalc.php?lvl=100&ml=40", so in damagecal.php, I can get that info using $_REQUEST['lvl'] for example

I have looked all over google and I can't find how to do this, and I have tried this a lot.

Hope someone understands what I'm saying
Thanks
 
Last edited:
If the URL looks like "index.php?lvl=100&ml=40" use $_GET['lvl'], $_GET['ml']
If it is send hidden by the form use $_POST['name']

I think $_GET is what you searched for.
 
@up
I think that's what my message contains.
 
If the URL looks like "index.php?lvl=100&ml=40" use $_GET['lvl'], $_GET['ml']
If it is send hidden by the form use $_POST['name']

I think $_GET is what you searched for.
I already knew how to get the data, I didn't know how to send it to the iframe from an external form.

But I solved in a really simple way, I guess I didn't test enough :p

This is what I used to test:
HTML:
 <form ACTION="test2.php" method="get" target="calc">
Level: <input name="level" size="3" maxlength="4" value="" type="text"><br>
MLevel <input name="mlevel" size="3" maxlength="4" value="" type="text"><br>
<input value="Submit" type="submit" style="font-family: Verdana; font-size: 10px; font-weight: bold; border: 1px double #000000;">
</form>

<iframe name="calc" src="test2.php" width="100%" height="550px" align="center"/>

test2.php
PHP:
<?PHP 
echo $_REQUEST['level']
?>
Thanks :)
 
Back
Top