Jump to content

jamina1

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by jamina1

  1. I'm printing the array directly from the process.php page the form points to. Right now as debugging, I'm forgoing everything besides the print_r command so I can see what's passing to PHP.
  2. Hey guys. I have a form that I am altering after page load with javascript. Basically I have a button that inserts another text field into the form which the user can fill out. Its for a calendar, and I'm allowing them to optionally add multiple days for an event. Each box that is created has the same name with [] on the end to make it an array. When I view the post array with print_r($_POST), only the first textbox's value shows up. This is the only textbox in the form when the page loads. Simplified example: <form name="calform" action="process.php" method="post"> <input name="startday[]" type="text" class="bordered" size="25" /> <input type="button" onclick="add_one_more()" value="Add another date" /> // if the user hits the add button it adds this input field after pageload <input name="startday[]" type="text" class="bordered" size="25" /> </form> And here's what I'd get from that form Array ( [startday] => Array ( [0] => test1 ) ) A button inside the form basically adds another <input> tag between the <form> tags. Why isn't PHP seeing the data?
  3. WOW! Thank you so much. Doing some research I figured I needed to use Joines somehow, but I didn't know how to make it work with looping and stuff. THANKS!
  4. [!--quoteo(post=388821:date=Jun 28 2006, 09:37 AM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Jun 28 2006, 09:37 AM) [snapback]388821[/snapback][/div][div class=\'quotemain\'][!--quotec--] damn I got just the thing you need. I am at a class right now I will be returning back to the office at 2pm EST will give you code then. Sorry for the wait. Someone may help in the meantime though. Ray [/quote] Ya still there? Please! I need help!
  5. Hi guys. I'm trying to write out a script that will show certain information based on the id numbers fed to it using Get. Url looks like this blah.php?id=106,105,255 (or something similar) Here's the basic database structure I'm working with - unfortunately it can't be changed or combined into one table. Table: Project_author projectId authorId Table: Faculty facultyid (which is the same as authorId) fname (first name) lname (last name) Table: Project id (same as projectId) Title (title of project) My query would be simple if all of these tables were in one! What I'm trying to do is list out the projects by certain authors. I've accomplished this with the following code: HOWEVER because I have to get each entry by its ID number from a different table one at a time, I can't alphabetize them using ORDER BY lname. I tried doing various joins but it doesn't work. The id numbers are fed to the query using $_GET. Here's what works to list them out - but I need it to be alphabetized. Help! [code] $id = $pieces = explode(",",$_GET['id']); echo "<div align='center' class='title'><strong>Projects by Author</strong></div>"; foreach($id as $k => $authorId) {   #Get Author Heading   $name = mssql_query("SELECT fname,lname,facultyid FROM Directory.dbo.Faculty   WHERE facultyId=$authorId");   while($result = mssql_fetch_assoc($name)) {     echo "<ul class='heading'><li>".$result['fname']." ".$result['lname']."</li>";     #Get projects by this AuthorId     echo "<ul class='materia'>";     $projects = mssql_query("SELECT DISTINCT projectId FROM Project_author     WHERE authorId = $authorId");     while($these = mssql_fetch_assoc($projects)) {        $info = mssql_query("SELECT title,id FROM Project        WHERE id =".$these['projectId']."ORDER BY title");        while($display = mssql_fetch_assoc($info)) {         echo "<li><a href='display.php?project=".$display['id']."'>".$display['title']."</a></li>";        }     } echo "</ul>";   } echo "</ul>"; } [/code]
  6. [!--quoteo(post=369268:date=Apr 27 2006, 11:57 AM:name=micah1701)--][div class=\'quotetop\']QUOTE(micah1701 @ Apr 27 2006, 11:57 AM) [snapback]369268[/snapback][/div][div class=\'quotemain\'][!--quotec--] can you just use a pair of empty quotes instead of NULL: $_SESSION['SubCat'.$value] = ""; now you have a declared var with no value. same effect, better result. [/quote] Doesn't work, it just passes an empty variable to SQL, instead of NULL. I absolutely NEED it to read NULL. The reason for this is the database is used for a navigation menu. If there is just an empty variable, it reads " " as a heading for a navigation bar. Unless it is NULL it will read out as a blank category, which messes up the nav bar. So, how do I make it tell it NULL?
  7. Hi! I'm making an HTML backend for a site I'm working on. Basically, I'm trying to make a more user friendly interface for people interacting with our database. Currently I have a form that validates itself before submitting. Problem is that some of these fields will be left blank from time to time. If they ARE left blank, I need PHP to pass NULL to the SQL table so that it doesn't display that value. Currently it's passing ''. I have a form getting values from the Database, which can then be edited and re-submitted. If a value is set to NULL in the database, it reads out as " " in the form value. Before I submit it back to the database, I check to make sure it doesn't equal "" or isn't empty() or even isn't Null. I even SET it to Null if it is one of these things. Still, I don't get the actual Null value in the SQL database. [code]if(trim($_POST['SubCat'.$value])==""||trim($_POST['SubCat'.$value])===NULL||empty($_POST['SubCat'.$value])) {             $_SESSION['SubCat'.$value] = NULL;             } else {             $_SESSION['SubCat'.$value]=$_POST['SubCat'.$value];             }[/code] That checks to see if its empty, but still SQL doesn't see NULL. The $value variable is there because the Post names are dynamically generated depending on which DB entries they are editing. HELP!
×
×
  • 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.