Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

php question

Name: Anonymous 2011-06-27 14:58

Ohai, this is an actual programming question.  Basic php shit.


Need to exclude whitespaces from mysql input. Basically the field shouldn't have spaces in it.   When user inserts space accidentally, php needs to eliminate it, whether searching or updating the field.

<tr><td>Model# </td><td><input type="text" name="model" size="" /></td></tr>

<?php
$id = $_POST[''];
$model = $_POST['model'];
$query= "INSERT INTO product_specs (ID, model)
VALUES ('NULL', '".$model."')";
?>



Also need to exclude whitespaces from mysql query. 

<form onsubmit="return false;">
Model: <input onkeyup="getSpecs(this.value)" />
<input type="submit" value="Submit"/>

<?php
$model=$_GET["model"];
$result = mysql_query("select * from product_specs where model ='$model'");
if ($row = mysql_fetch_object($result)) {
echo 'Model# '. $row->model . '<br />';
}
?>

Name: Anonymous 2011-06-27 15:49

Go directly to reddit, do not read SICP, do not reach satori.

Name: Anonymous 2011-06-27 16:01

actual programming
php

Name: Anonymous 2011-06-27 17:17

FELCH my ANUS

Don't change these.
Name: Email:
Entire Thread Thread List