Linjon Posted June 19, 2011 Share Posted June 19, 2011 Hello. How to make script that adds number to name? Something like that: <?php $random = rand(10, 50); $name1 = "Jack"; $together = ($name1 + $random); ?> $together must be without space, example: jack32 Thanks! Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted June 19, 2011 Share Posted June 19, 2011 <?php $random = rand(10, 50); $name1 = "Jack"; $together = $name1.$random; ?> Quote Link to comment Share on other sites More sharing options...
Linjon Posted June 19, 2011 Author Share Posted June 19, 2011 Wow, so fast. Thanks, it worked! Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted June 19, 2011 Share Posted June 19, 2011 Quote Link to comment Share on other sites More sharing options...
Linjon Posted June 20, 2011 Author Share Posted June 20, 2011 I have some more questions but i will write these here. How can i edit php file via php? <html> <body> <form method="post"> <table> <tr><td>Age:</td><td><input type="text" name="age"></td> </tr> <tr><td><input type="submit" value="Submit" name="submit"></td></tr> </table> </form> </body> </html> if (isset($_POST['submit'])) { $myFile = "oldfile.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $age = $_POST['age']; fwrite($fh, $access); fclose($fh); echo "Done!"; } ?> Example: in oldfile.php should have age = "24" Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted June 20, 2011 Share Posted June 20, 2011 linjon- start a new thread Quote Link to comment Share on other sites More sharing options...
Linjon Posted June 20, 2011 Author Share Posted June 20, 2011 Nah, can do it here too So, anyone know how to make that? I have some more questions but i will write these here. How can i edit php file via php? <html> <body> <form method="post"> <table> <tr><td>Age:</td><td><input type="text" name="age"></td> </tr> <tr><td><input type="submit" value="Submit" name="submit"></td></tr> </table> </form> </body> </html> if (isset($_POST['submit'])) { $myFile = "oldfile.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $age = $_POST['age']; fwrite($fh, $access); fclose($fh); echo "Done!"; } ?> Example: in oldfile.php should have $age = "24" Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 20, 2011 Share Posted June 20, 2011 Nah, can do it here too So, anyone know how to make that? Yes, I do. But, I won't answer here because you don't want to start a new thread for a question that is unrelated to this post. Quote Link to comment 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.