emzz Posted February 13, 2011 Share Posted February 13, 2011 Hi there, I need help with my form. i have this from which user will fill out e.g name telephone and a message. i want to add pre text after the message e.g name phone message preTEXT. how do i do that ? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 13, 2011 Share Posted February 13, 2011 Code? Quote Link to comment Share on other sites More sharing options...
emzz Posted February 13, 2011 Author Share Posted February 13, 2011 index.php <HTML> <HEAD><TITLE>Send SMS</TITLE></HEAD> <BODY> <form method="post" action="sent.php"> <table border="1"> <tr> <td>Mobile Number:</td> <td><input type="text" name="phone" size="40"></td> </tr> <tr> <td valign="top">Text Message:</td> <td><textarea name="text" cols="80" rows="10"></textarea> </tr> <tr> <td colspan="2" align="center"> <input type="submit" value="Send"> </td> </tr> </table> </form> </BODY> </HTML> sent.php <?php function SendSMS ($host, $port, $username, $password, $phoneNoRecip, $msgText) { $fp = fsockopen($host, $port, $errno, $errstr); if (!$fp) { echo "errno: $errno \n"; echo "errstr: $errstr\n"; return $result; } fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" . rawurlencode($msgText) ." HTTP/1.0\n"); if ($username != "") { $auth = $username . ":" . $password; $auth = base64_encode($auth); fwrite($fp, "Authorization: Basic " . $auth . "\n"); } fwrite($fp, "\n"); $res = ""; while(!feof($fp)) { $res .= fread($fp,1); } fclose($fp); return $res; } if (isset($_REQUEST['phone'])) { if (isset($_REQUEST['text'])) { $x = SendSMS("192.168.10.12", 8808, "user", "password", $_REQUEST['phone'], $_REQUEST['text']); echo $x; } else { echo "ERROR : Message not sent -- Text parameter is missing!\r\n"; } } else { echo "ERROR : Message not sent -- Phone parameter is missing!\r\n"; } ?> So when user submits the form i want to add a pre text after users message Quote Link to comment Share on other sites More sharing options...
emzz Posted February 13, 2011 Author Share Posted February 13, 2011 help ppl please need it urgent Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 13, 2011 Share Posted February 13, 2011 Do not bump threads. Do not imply that a problem is urgent. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2011 Share Posted February 13, 2011 Uhm... $msgText .= "Whatever"; You go from using your parameters from the function, to using the $_REQUEST array, which will probably cause problems. Quote Link to comment Share on other sites More sharing options...
emzz Posted February 13, 2011 Author Share Posted February 13, 2011 Uhm... $msgText .= "Whatever"; You go from using your parameters from the function, to using the $_REQUEST array, which will probably cause problems. is there any ways u can simplyfy? will b great help im new to this Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2011 Share Posted February 13, 2011 I don't think I can simplify how to add text to the end of other text any more than that. If you're that new, rather than attempting something complicated, and using other people's code, read tutorials and learn yourself, do small projects, and work up to something involving texting. 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.