Page 1 of 1
Text link from button with hidden form fields
Posted: Wed Sep 27, 2006 9:24 am
by cdickson
Is there any way I can create a text link from a button with a myriad of hidden form fields?
Code for form field is:
Code: Select all
<form action="test.php" method="POST">
<input type="submit" value="Get Comments">
<input type="hidden" name="user" value="SAMPLE">
<input type="hidden" name="pass" value="test123">
<input type="hidden" name="sessid" value="1">
<input type="hidden" name="tablename" value="sample">
<input type="hidden" value="07" name="startdate-month">
<input type="hidden" value="01" name="startdate-date">
<input type="hidden" value="2005" name="startdate-year">
<input type="hidden" value="12" name="enddate-month">
<input type="hidden" value="31" name="enddate-date">
<input type="hidden" value="2005" name="enddate-year">
<input type="hidden" value="All Patients" name="categoryid">
<input type="hidden" value="12" name="demographic">
<input type="hidden" name="survey_question" value="53">
<input type="hidden" name="patcomments" value="">
<input type="hidden" name="answer" value="A.Better than expected">
<input type="hidden" name="report" value="Get Comments Only"></td>
</form>
Posted: Wed Sep 27, 2006 9:48 am
by Buddha443556
Not quiet sure what you mean but how about using method="GET"?
Posted: Wed Sep 27, 2006 11:21 am
by scorphus
Also, you could use session to keep part of the information like username, password, session validity etc.
Posted: Thu Sep 28, 2006 10:29 am
by cdickson
I need to rephrase my question and update my code from a sample page that was given to me previously to the actual code that is in place.
Following is the code being used to generate the report and the "Get Comments" submit button. The goal is to generate the same report using a text link instead of the submit button. I appreciate the previous input, but I'm a little green and still need some coaching.
Code: Select all
echo '<form action="test.php" method="POST">';
echo '<td align="center" class="report_data_count">';
echo '<input type="submit" value="Get Comments">';
echo '<input type="hidden" name="user" value="'.$_POST['user'].'">';
echo '<input type="hidden" name="pass" value="'.$_POST['pass'].'">';
echo '<input type="hidden" name="sessid" value="'.$_POST['sessid'].'">';
echo '<input type="hidden" name="tablename" value="'.$GLOBALS['TEST']['TABLE_NAME'].'">';
echo '<input type="hidden" value="'.$_POST['startdate-month'].'" name="startdate-month">';
echo '<input type="hidden" value="'.$_POST['startdate-date'].'" name="startdate-date">';
echo '<input type="hidden" value="'.$_POST['startdate-year'].'" name="startdate-year">';
echo '<input type="hidden" value="'.$_POST['enddate-month'].'" name="enddate-month">';
echo '<input type="hidden" value="'.$_POST['enddate-date'].'" name="enddate-date">';
echo '<input type="hidden" value="'.$_POST['enddate-year'].'" name="enddate-year">';
echo '<input type="hidden" value="'.$_POST['categoryid'].'" name="categoryid">';
echo '<input type="hidden" value="'.$REPORT_DATA['DEMOGRAPHIC_ID'].'" name="demographic">';
echo '<input type="hidden" name="survey_question" value="'.$REPORT_DATA['SURVEY_QUESTION_ID'].'">';
echo '<input type="hidden" name="patcomments" value="">';
echo '<input type="hidden" name="answer" value="'. $REPORT_DATA['SURVEY_QUESTION_LIST'][$x] .'">';
echo '<input type="hidden" name="report" value="Get Comments Only">';
echo '</td>';
echo '</form>';
Thanks to anyone willing to help.
Posted: Sun Oct 01, 2006 10:03 pm
by scorphus
Ok, how about adding a link with an onClick event set to the form submission?
You could clean your form removing the table information (<td>) and the submit button and then give it a name:
Code: Select all
echo '<form name="comment_form" action="test.php" method="POST">';
echo '<input type="hidden" name="user" value="'.$_POST['user'].'">';
echo '<input type="hidden" name="pass" value="'.$_POST['pass'].'">';
echo '<input type="hidden" name="sessid" value="'.$_POST['sessid'].'">';
echo '<input type="hidden" name="tablename" value="'.$GLOBALS['TEST']['TABLE_NAME'].'">';
echo '<input type="hidden" value="'.$_POST['startdate-month'].'" name="startdate-month">';
echo '<input type="hidden" value="'.$_POST['startdate-date'].'" name="startdate-date">';
echo '<input type="hidden" value="'.$_POST['startdate-year'].'" name="startdate-year">';
echo '<input type="hidden" value="'.$_POST['enddate-month'].'" name="enddate-month">';
echo '<input type="hidden" value="'.$_POST['enddate-date'].'" name="enddate-date">';
echo '<input type="hidden" value="'.$_POST['enddate-year'].'" name="enddate-year">';
echo '<input type="hidden" value="'.$_POST['categoryid'].'" name="categoryid">';
echo '<input type="hidden" value="'.$REPORT_DATA['DEMOGRAPHIC_ID'].'" name="demographic">';
echo '<input type="hidden" name="survey_question" value="'.$REPORT_DATA['SURVEY_QUESTION_ID'].'">';
echo '<input type="hidden" name="patcomments" value="">';
echo '<input type="hidden" name="answer" value="'. $REPORT_DATA['SURVEY_QUESTION_LIST'][$x] .'">';
echo '<input type="hidden" name="report" value="Get Comments Only">';
echo '</form>';
Then place the link with the proper event in the exact point where you want it:
Code: Select all
echo '<a href="#" onClick="javascript:document.comment_form.submit();">Get Comments</a>';
Hope that helps

submit link
Posted: Mon Oct 02, 2006 1:24 am
by rssajkow
you can also make a standard submit button and then make it look like a text link with css, this will allow use of the post method. IE....<input type="submit" name="submit" value="submit" class="details">
input.details
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px; line-height:13px;
font-weight: normal;
color:#0000FF;
padding:0;
margin:0;
background-color:transparent;
text-decoration: none;
border: none;
cursor: pointer;
cursor: hand;
}
input.details:hover
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px; line-height:18px;
font-weight: normal;
color:#FF0000;
background-color:transparent;
text-decoration: underline;
border: none;
cursor: pointer;
cursor: hand;
}
Posted: Mon Oct 02, 2006 7:46 am
by cdickson
Excellent ideas! Thanks - I will try them both and see which works best.