-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
if(!$_POST['submit']){ echo "<form method=post action=thispage.php>\n"; echo "Teacher Name: <input type=text name=tname><br>\n"; echo "Room #: <input type=text name=room><br>\n"; echo "<input type=submit name=submit value=go>\n"; echo "</form>\n"; }else { $teacher = $_POST['tname']; $room = $_POST['room']; if($teacher && $room){ //do this }else { //not supplied } }
-
Try putting the text field before the submit field.
-
Why not use a switch for that.
switch($row_userinfo['level']){ case 1: $level = "User"; break; case 3: $level = "Admin"; break; default: $level = "User"; } echo $level;
-
$search = mysql_real_escape_string($_GET[search]); $sql = "SELECT * FROM `phones` WHERE `make` LIKE '%$search%' OR `model` LIKE '%$search%'"; $result = mysql_query($sql) or die(mysql_error());
-
Once the part before the sleep(10); line occurs all that data will be loaded. And after 10 seconds of cooling down, the part after that line will load then.
-
Suppresses error reporting.
-
We can't help without some source.
-
//do this first sleep(10); //relax the script for 10 seconds //do second thing
-
//uncomment the $tot if($tot >= 1){ //show contacts }else { //no contacts }
-
The values obviously don't exist, there would be content within the single quotes if the variables had a string value.
-
The values are blank. And you don't need that comma before calling the WHERE operator.
print_r($_POST)
-
Why not use a dropdown? Lol. It looks fine to me.
$array = array('edit','delete','change'); if(!$_GET['action'] || !in_array($_GET['action'],$array)){ echo "<form name=\"switch\" method=\"get\" action=\"switch.php\">\n"; echo "Option: <select name=\"action\">\n"; foreach($array AS $options){ echo "<option value=\"$options\">".ucfirst($options)."</option>\n"; } echo "</select> <input type=\"submit\" value=\"Switch Away Captain\"></form>\n"; }else { switch($_GET['action']){ case edit: echo "omfg edit"; break; case delete: echo "omfg delete"; break; case change: echo "omfg change"; break; default: echo "omfg wtf"; } }
-
Best try would be going into Command Mode, ESC + :, then enter the line "syntax on" [remove quotes]
-
NULL or 0 is supplied as an unknown value. So using "NOT NULL" there's going to be a supplied value why entering the data into the field.
-
Also, when you're defining the values in the foreach statement give them names that have a line break or something, so they don't get all cluttered.
-
Well duh, make sure you're passing the field as an array.
<input type="checkbox" name="sexy[]" id="1-3">
-
I just provided an easier example.
-
$sql = "SELECT * FROM `this` WHERE `that`='grapejuice'"; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ $first = $row['first']; $last = $row['last']; $dname = $row['displayname']; $picurl = $row['pictureurl']; echo "Like hello your name is $first $last, your display name is $dname and your picurl is $picurl, get used to it!\n"; }
Might I add if you're going to use the $i < $num, make sure the less than sign has the inequality of less than or equal to. Because 1 < 3 will produce results 1 and 2.
-
What variables exactly?
-
Correct.
-
Does the path exist? Try using file_exists(); to see if that file even exists.
-
<?php if(!$_POST[submit]){ echo "<form name=\"this\" action=\"index.php\" method=\"post\">place: <input type=\"text\" name=\"place\">\n"; echo "<input type=\"submit\" value=\"GO GO GO\" name=\"submit\"></form>\n"; }else { $place = $_POST['place']; if($place){ $sql = "SELECT * FROM `tbl` WHERE `place` LIKE '%$place%'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "no results\n"; }else { while($row = mysql_fetch_assoc($res)){ echo "place name: $row[place] | some other field: $row[field1]<br>\n"; } } }else { echo "omg no place\n"; } } ?>
modify it to your extent
-
Are you outputting the data into an image?
-
You're saying you can't add the info to the database? Is all your POST data correct? (e.g., the field names)
Have you tried using "or die(mysql_error())" on the actual insert query?
[SOLVED] Variable with spaces
in PHP Coding Help
Posted
Just put quotes around the PHP Statement and you should be set.