Hi,
I have a pretty basic puzzle/question… is it possible to use PHP to create automated input into form fields?
I.e. in a record insertion form, can you duplicate & combine the input values of 2 form fields, e.g. “Client Name” & “Client Age” and put them into a hidden field called “Client Name & Age” without the user having to re-type their entries into 3 seperate form fields?
This may seem like a strange query, I’m a looking for the simplest way to produce a records search facility on my website, based on a limited knowldege of PHPl… My table is like this:
- Product category
- Product make
- Product description
- Product model
I want PHP to automatically generate these keywords based on what the user inputs into the form - almagamating all of their categories of info into one recordset. Can it be done? I do have a search facility up and running, but it matches up records seperately from all these 4 different collumns based on the form input. This has limitations - i.e. you can’t currently search both make & model at the same time.
This is a snippet of the code I have used - it works, i.e. the page functions and the record is inserted, but the KeyWords collumn remains empty. As a new PHP learner, I’m wondering have I hit a wall in the basics of scripting…?? Help much appreciated, thanks
$editFormAction = $_SERVER[‘PHP_SELF’];
if (isset($_SERVER[‘QUERY_STRING’])) {
$editFormAction .= “?” . htmlentities($_SERVER[‘QUERY_STRING’]);
}
if ((isset($_POST[“MM_insert”])) && ($_POST[“MM_insert”] == “form1”)) {
$insertSQL = sprintf(“INSERT INTO tbl_audio_amps (productID, category, make, model, description, price, quantity, keyWords) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)”,
GetSQLValueString($_POST[‘productID’], “int”),
GetSQLValueString($_POST[‘category’], “text”),
GetSQLValueString($_POST[‘make’], “text”),
GetSQLValueString($_POST[‘model’], “text”),
GetSQLValueString($_POST[‘description’], “text”),
GetSQLValueString($_POST[‘price’], “text”),
GetSQLValueString($_POST[‘quantity’], “text”),
GetSQLValueString($_POST[‘category’][‘make’][‘model’][‘description’], “text”));
mysql_select_db($database_connUsedEquipment, $connUsedEquipment);
$Result1 = mysql_query($insertSQL, $connUsedEquipment) or die(mysql_error());
$insertGoTo = “display/used_equipment.php”;
if (isset($_SERVER[‘QUERY_STRING’])) {
$insertGoTo .= (strpos($insertGoTo, ‘?’)) ? “&” : “?”;
$insertGoTo .= $_SERVER[‘QUERY_STRING’];
}