1

EDIT: Answered by a comment, thank you!

Does < form > not work within php's print?

I've been working through this page, building the pieces I want it to have- my final glitch is that the submit button is not active AT ALL.

I have a page that uses jquery to hide a div that contains information submitted by the user- these are shown when the administrator clicks on the button to show the abstract.

In the div that is hidden, there are two columns- one of which has a super short form- the admin clicks on a radio button to categorize the submitted information. This is where the submit button simply isn't working.

The form shows up, in fact, everything looks exactly as expected. I know the code otherwise works because I tried it by itself on another page- so I'm assuming there's knowledge I do not have and cannot find.

Any advice?

<?php
 include('filethatconnectstothedatabase.php');
 $conn = new DatabaseConn();
 $query = ("
          SELECT *
          FROM abstracts
          WHERE visible=\"1\"
          ");
 $result = mysql_query($query);

 $numfields = mysql_num_fields($result);
 $data = array();
 $flist = array();

for($i=0;$i<$numfields;$i++)$flist[] = mysql_field_name($result,$i);
  $data[0] = $flist;
  while($row = mysql_fetch_assoc($result)){
  $data[] = $row;

print '

<div id="table-'.$row['abstractid'].'" class="hide">
   <div class="column1">
   <ul>
    <li>
   <span class="spantitle">Author:</span> ' . $row['abstract_author'] .'
   </li>

   <li><span class="spantitle">Applicant Type:</span> ' . $row['applicant_type'] .'
   </li>

   <li>
    <span class="spantitle">Presentation Type:</span> ' . $row['presentation_type'] .'
   </li>

   <li>
  <span class="spantitle">Affiliation:</span> ' . $row['author_affiliation'] .'
  </li>

  <li>
 <button data-hide-id="'.$row['abstractid'].'" class="read-abstract">
  Hide Abstract
 </button>
</li>

</ul>

<div class="clr"></div>

<form action="assign_abstract.php" method="post">

<fieldset>
  <span class="spantitle">Assign Session for abstract # '. $row['abstract_id'] .':</span>
  <input type="hidden" name="abstract_id" value="'. $row['abstract_id'] .'" />

  <br />
  <input type="radio" name="abstract_category" value="session1" />Session One:
  <br />
  Session One

  <br />
  <input type="radio" name="abstract_category" value="session2" />Session Two:
  <br />
  Session Two

  <br />
  <input type="radio" name="abstract_category" value="session3" />Session Three:
  <br />
  Session Three

  <br />
  <input type="radio" name="abstract_category" value="session4" />Session Four:
  <br />
  Session Four

  <br />
  <input type="radio" name="abstract_category" value="notapplicable" />Not Applicable

  <br />
  <br />
  <input type="button" name="submit" value="submit" />

  </fieldset>

  </form>
2
  • 3
    Shouldn't your submit button be type="submit"? Commented Aug 28, 2012 at 19:01
  • @andrewsi wow. /facepalm thank you! I just couldn't see it. Commented Aug 28, 2012 at 19:04

2 Answers 2

2

Forms work fine inside of php echo's and prints. Did you try type submit instead of type button? Example:

<input type="submit" name="submit" value="submit" />

instead of

<input type="button" name="submit" value="submit" />
Sign up to request clarification or add additional context in comments.

Comments

2

First: you should probably be using <input type="submit"> - and I am not sure if it is just what you pasted into stackoverflow or not but you are missing the closing comma and semi-colon. The other thing you will want to look into is what you are actually populating into the values. View your source for the page that is being created to make sure that nothing is putting unexpected characters into your output.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.