Dropdown menu without button and kill a script inside a div.

Junior Spellweaver
Joined
Nov 15, 2009
Messages
106
Reaction score
1
Hey guys, I have two questions.
First:
Code:
<?php if ($lang_change=="sessioncookie"){?>
<form action='' method='post'><table border='0'>
<tr><td><?php echo "$lang_language:";?>
<select name="lang">
<option value="english" <?php if ($_SESSION['language']=="english") {echo "selected='selected'";}?>>English</option>
<option value="svenska" <?php if ($_SESSION['language']=="svenska") {echo "selected='selected'";}?>>Svenska</option>
</select>
Thats my code to change language on my page. I wanna make it work without having to press the confirm button every single time. So when you change in menu it automaticly change on the whole page.

Second: I have made a page with a php script inside it. The php script is inside a div and when something goes wrong, like weird characters when you click submit, i use die(""); to kill the script but it also kills the stuff under the div, like the footer and stuff. how do i bypass that so its only the php part that stop and not the footer aswell.

Thanks alot for answers! Merci!
 
Hey guys, I have two questions.
First:
Code:
<?php if ($lang_change=="sessioncookie"){?>
<form action='' method='post'><table border='0'>
<tr><td><?php echo "$lang_language:";?>
<select name="lang">
<option value="english" <?php if ($_SESSION['language']=="english") {echo "selected='selected'";}?>>English</option>
<option value="svenska" <?php if ($_SESSION['language']=="svenska") {echo "selected='selected'";}?>>Svenska</option>
</select>
Thats my code to change language on my page. I wanna make it work without having to press the confirm button every single time. So when you change in menu it automaticly change on the whole page.

Second: I have made a page with a php script inside it. The php script is inside a div and when something goes wrong, like weird characters when you click submit, i use die(""); to kill the script but it also kills the stuff under the div, like the footer and stuff. how do i bypass that so its only the php part that stop and not the footer aswell.

Thanks alot for answers! Merci!

You can't. Killing PHP with die(), exit() or anything similar to this will stop all output at this very point, that means nothing. that should be performed after this function, will be performed.

What do you mean by weird characters ? Narrow what the script can do and can't do and prepare a default option.
 
You say you have a form in a page that is submitted and if anything goes wrong it should stop.
Pass the the submitted variables through a function to check if all data is to ur liking, if not return some error message.
 
The web is much too hard for beginners... 99% of web developers don't know the HTTP or HTTPS specifications- let alone the HTML/CSS specifications or even know what the EcmaScript 5th edition is- which is all required in order to develop a dynamic web-site with any certainty as to what will happen in production. PHP only confuses the situation, yet somehow beginners can mess up a web-site even more by altering how the server reacts to HTTP requests.

My only advice to you is to keep learning, and don't rush and ask for help- just read the manual and if you don't understand a feature, then ask questions or read other questions ppl asked. I really cannot explain to you what is happening in any way you'd really understand, there's just tons of missing information. It could take me 2 years to really tell you what is happening and for you to understand it.
 
Back