Jump to content

PHP input field to two fields


everlifefree

Recommended Posts

Ok here's what'd I'd like to do but needs some help on how to do it. The sms_address is coming in from one text input field and what I'd like to do is make it so there is the text field and a drop down field. That combine together to make the sms_address that is submitted.

 

Here's my current code...

// HANDLE SUBMITTED MOBILE BEHAVIOR CONFIG //
if (isset($_POST["SubmitMobile"])) {

	if (!isset($mySettings)) $mySettings = unpk(me("settings"));
	if (!is_array($mySettings)) $mySettings = array();

	$mySettings["MOBILE"]["SMSADDRESS"] = (preg_match($CONF["REGEXP_EMAIL"], $_POST["sms_address"])?$_POST["sms_address"]:NULL);
	$mySettings["MOBILE"]["TRUSTCONTACTS"] = (ckbool($_POST["sms_trustcontacts"])?true:false);
	$mySettings["MOBILE"]["EXCLUDEONLINE"] = (ckbool($_POST["sms_excludeonline"])?true:false);

	myQ("UPDATE `[x]users` SET `settings`='".pk($mySettings)."' WHERE `id`='".me("id")."'");

}

Link to comment
https://forums.phpfreaks.com/topic/94105-php-input-field-to-two-fields/
Share on other sites

  • 2 weeks later...

you overall code doesn't make sense

there are a number of problems

<?
// HANDLE SUBMITTED MOBILE BEHAVIOR CONFIG //
if (isset($_POST["SubmitMobile"])) {

	if (!isset($mySettings)) $mySettings = unpk(me("settings"));
	if (!is_array($mySettings)) $mySettings = array();

	$mySettings["MOBILE"]["SMSADDRESS"] = (preg_match($CONF["REGEXP_EMAIL"], $_POST["sms_address"])?$_POST["sms_address"]:NULL);
	$mySettings["MOBILE"]["TRUSTCONTACTS"] = (ckbool($_POST["sms_trustcontacts"])?true:false);
	$mySettings["MOBILE"]["EXCLUDEONLINE"] = (ckbool($_POST["sms_excludeonline"])?true:false);
// what is all this stuff???????

	myQ("UPDATE `[x]users` SET `settings`='".pk($mySettings)."' WHERE `id`='".me("id")."'");
myQ ??? // WRONG, its mysql_query
`[x]users`// whats the [x]? a variable?... then you have to use the [$x]
".pk($mySettings)."' // i don't uiserstand what uo're veen trying to do
".me("id")."'" // same here
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.