I am creating an page to connect to an API, I am posting variables to the handler, I'm also storing them in a mySQL database which is all fine and dandy.
The string is '$userfullname' which is (actually, I need not explain the variable..) to test, I've echoed it on the page, I get the result:
"Ed Reardon" as expected.
<?php
echo $userfullname;
?>
<div class="form-group">
<form action="sms.php" method="post">
<h3>SMS Message</h3>
<input type="hidden" name="usr" id="usr" value=<?php echo $userfullname; ?> />
<input type="hidden" name="num" id="num" value="****" />
<textarea id="msg" name="msg" class="form form-control" rows="5"></textarea>
<span id="text_counter"></span><input class="btn btn-large btn-primary pull-right" type="submit" id="posting" value="Post" />
</div>
When it goes to my handler, my database just shows Ed, or Tim, or Cathy or whatever, I'm only getting the portion before the space in the name. The database is set to hold this as a varchar (225) and it's suspicious as I'm getting only the first name in the database, but I get the full name on echo.
This is the portions of the handler where the variable is being passed:
<?php
$msg = $_POST['msg'];
$usr = $_POST['usr'];
$num = $_POST['num'];
$recp = $_POST['recp'];
require_once 'modules/autoload.php';
require_once 'connect.php';.... Then some API magic.
Then lower, the database insert functions:
$stmt = $dbmain->prepare("INSERT INTO sms (sender, recipient, message, guid, send_time) VALUES (?, ?, ?, ?, NOW())");
$stmt->bind_param("ssss", $usr,$num,$msg,$guid);
$stmt->execute();
$affectedrows = $dbmain->affected_rows;
$errornoreturn = $dbmain->errno;
$stmt->close();
?>
To clarify, the string isn't making it's way to the DB, only the first part is.