shebbycs Posted November 3, 2011 Share Posted November 3, 2011 Form.php <html> <head> <script type="text/javascript"> function addsmiley(code) { var pretext = document.smile.message.value; this.code = code; document.smile.message.value = pretext + code; } function a() { var x = document.smile.message.value; if(x=="") { alert("Please insert an message!"); return false; } } </script> <style type="text/css"> body{ background-color: #d8da3d } </style> </head> <body> <form name="smile" method="post" action="registration.php" onSubmit="return a()" > Your message:<br><textarea name='message' cols='40' rows='2'></textarea><br> <img src="smile.gif" alt="" onClick="addsmiley('')" style="cursor:pointer;border:0" /> <img src="blush.gif" alt="" onClick="addsmiley('*blush*')" style="cursor:pointer;border:0" /> <input type='submit' name='submit' value='Set Name' class='biasa' ></form> <br> <br> </body> </html> Registration.php <?php $m=$_POST['message']; echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('$m')</SCRIPT>"); ?> <html> <head> <script type="text/javascript"> function a() { var x = document.register.username.value; var y = document.register.pass.value; var z = document.register.pass2.value; if(x==""&& y==""&& z=="") { alert("Please insert all message!"); return false; } if(x=="") { alert("Please insert an username!"); return false; } if(y=="") { alert("Please insert an password!"); return false; } if(z=="") { alert("Please insert an password2!"); return false; } if (y!=z) { alert("Your passwords did not match"); return false; } } </script> </head> <body> <form name="register" method="post" action="login.php" onsubmit="return a()"> <table border='0'> <input type="text" name="<?php $m?>"> <tr><td>Username:</td><td><input type="text"name="username" maxlength="60"></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="10"></td></tr> <tr><td>Confirm Password:</td><td><input type="password" name="pass2" maxlength="10"></td></tr> <tr><th colspan=2><input type="submit" name="sub" value="Register"></th></tr> </table> </form> </body> </html> Your message:<br><textarea name='message' cols='40' rows='2'></textarea><br> This i took from form.php and when it passed to registration.php when im called it in javascript <?php $m=$_POST['message']; echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('$m')</SCRIPT>"); it can show the message im put in form.php but when im put into input text that is <input type="text" name="<?php $m?>"> but the input text is blank not put the message im post in form php may i know which is the error Quote Link to comment https://forums.phpfreaks.com/topic/250354-how-the-post-message-can-put-to-another-page-form/ Share on other sites More sharing options...
trq Posted November 3, 2011 Share Posted November 3, 2011 What? Quote Link to comment https://forums.phpfreaks.com/topic/250354-how-the-post-message-can-put-to-another-page-form/#findComment-1284529 Share on other sites More sharing options...
shebbycs Posted November 3, 2011 Author Share Posted November 3, 2011 im means the textarea message from form php im wan to take it data so im using post method but when im put that into input text it seems the text only blank not fill with the message im input from form.php this above is form.php and now im put sate word and im want it to pass to the first textfield this above is registration.php so im want the aaa textfield to be fill with the word sate Quote Link to comment https://forums.phpfreaks.com/topic/250354-how-the-post-message-can-put-to-another-page-form/#findComment-1284543 Share on other sites More sharing options...
trq Posted November 3, 2011 Share Posted November 3, 2011 Obviously English isn't your first language. I'm still not understanding your post. Quote Link to comment https://forums.phpfreaks.com/topic/250354-how-the-post-message-can-put-to-another-page-form/#findComment-1284564 Share on other sites More sharing options...
shebbycs Posted November 4, 2011 Author Share Posted November 4, 2011 actually im had figure out myself sir which i changed from this code <input type="text" name="<?php $m?>"> to this code <input type="hidden" name="message" value="<?php echo $m;?>"> my problem solved thank you sir Quote Link to comment https://forums.phpfreaks.com/topic/250354-how-the-post-message-can-put-to-another-page-form/#findComment-1284831 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.