Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> JavaScript
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Wed Aug 20, 2008 7:58 am Reply with quote

I need this form to submit and post the values of export_type except it is not.

The problem is with the submit button.

Code:


<input type="button" name="export" value="Submit" onclick="javascript:window.location=\''.append_sid('export_grades.php?action=export&ARG1='.$cid.'&ARG2='.$qid).'\'">';
      


It doesn't really submit anything. I still need to be able to pass these other values in the URL but also need to post the new values.

I think I need a onclick="this.form.submit();" but don't know how to implement.

Here is the relevant code.



Code:
   echo    "<form name='exportgrades' action='".$_SERVER['php_self']."' method='POST'>"; 

//-- BEGIN quiz_report -->
echo"<tr>"
   .         "<td class='row3' height='25'>"
   .            "<span class='cattitle'>Export Grades</span>"
   .         "</td>"
   .      "</tr>"
   .      "<tr>"
   .         "<td height='23' valign='middle'>"
   .            "<table width='80%'  cellpadding='5' cellspacing='0' border='0' align='left'>";
//-- BEGIN info -->
echo"<tr>"
    ."<td><select name=\"export_type\""
   ."<option value=\"IE\" selected>--Select Type--</option>"
   ."<option value=\"IE\">Initial Export</option>"
   ."<option value=\"AA\">Adjusted Answers</option>"
   ."<option value=\"LG\">Late Grades</option>"
   ."<option value=\"CE\">Corrupt Export</option>"
   ."</select> Select Type of Export"
   ."</td>"   
   ."</tr>"   
    ."<tr>"
   .                  "<td class='cattitle' align='left' valign='middle'> Exam Name: $quizname</td>"
   .               "</tr>"
   .                  "<td class='gen' align='left'> Once exams are exported they become locked.  This is so they cannot be exported again unless they are explicitly unlocked and re-exported.  Flight administrators only need to unlock the last known export.  This proccess will produce a comma delimited txt file to be imported into MedSIS.  The importation of these exam grades is not finished until the administrator completes the process in MedSIS.   </td>"
   .               "</tr>"   
   .               "</table>"
   .               "</td>"
   .               "</tr>"
   .               "</tr>"                  
   .               "<tr>"   
   .                        '<td class="gen" align="left" valign="middle"><input type="button" name="export" value="Submit" onclick="javascript:window.location=\''.append_sid('export_grades.php?action=export&ARG1='.$cid.'&ARG2='.$qid).'\'">';
      
    echo                    "</tr>";   
   echo               "</form>";



How can I merge

Code:
onClick="javascript:form.submit();"


with

Code:


onclick="javascript:window.location=\''.append_sid('export_grades.php?action=export&ARG1='.$cid.'&ARG2='.$qid).'\'">'
 
View user's profile Send private message Visit poster's website ICQ Number
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Wed Aug 20, 2008 9:29 am Reply with quote

Your form is posting data, but your on-click just bypasses it. What you want to do is a proper form submission with hidden variables

Code:


<input type="hidden" name="action" value="export">
<input type="hidden" name="ARG1" value="' . $cid . '">
<input type="hidden" name="ARG2" value="' . $qid . '">
<input type="submit" name="export" value="Submit">

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Donovan







PostPosted: Wed Aug 20, 2008 9:38 am Reply with quote

Doing it that way how could I append_sid() so I still have user authentication?
 
Donovan







PostPosted: Wed Aug 20, 2008 9:48 am Reply with quote

I changed it to this.

Code:
echo "<form name='exportgrades' action='".$_SERVER['php_self']."' method='POST'>"

    ."<tr>"
    ."<td><select name=\"export_type\">"
   ."<option value=\"IE\" selected>--Select Type--</option>"
   ."<option value=\"IE\">Initial Export</option>"
   ."<option value=\"AA\">Adjusted Answers</option>"
   ."<option value=\"LG\">Late Grades</option>"
   ."<option value=\"CE\">Corrupt Export</option>"
   ."</select> Select Type of Export"
   ."</td>"   
   ."</tr>"   
    ."<tr>"
   .                  "<td class='cattitle' align='left' valign='middle'> Exam Name: $quizname</td>"
   .               "</tr>"
   .                  "<td class='gen' align='left'> Once exams are exported they become locked.  This is so they cannot be exported again unless they are explicitly unlocked and re-exported.  Flight administrators only need to unlock the last known export.  This proccess will produce a comma delimited txt file to be imported into MedSIS.  The importation of these exam grades is not finished until the administrator completes the process in MedSIS.   </td>"
   .               "</tr>"   
   .               "</table>"
   .               "</td>"
   .               "</tr>"
   .               "</tr>"                  
   .               "<tr>"   
   .'<td class="gen" align="left" valign="middle">'
   .'<input type="hidden" name="action" value="export">'
   .'<input type="hidden" name="ARG1" value="' . $cid . '">'
   .'<input type="hidden" name="ARG2" value="' . $qid . '">'
   .'<input type="submit" name="export" value="Submit">'      
    .                    "</tr>"   
   .               "</form>";


However when the form submits to itself nothing happens.

At the top of the page I have

Code:


$mode = ( isset($_GET['action']) ) ? ($_GET['action']) : ( ( isset($_POST['action']) ) ? ($_POST['action']) : '') ;
$type = ( isset($_GET['export_type']) ) ? ($_GET['export_type']) : ( ( isset($_POST['export_type']) ) ? ($_POST['export_type']) : '') ;
$cid =  ( isset($_GET['ARG1']) ) ? ($_GET['ARG1']) : ( ( isset($_POST['ARG1']) ) ? ($_POST['ARG1']) : 0) ;
$qid =  ( isset($_GET['ARG2']) ) ? ($_GET['ARG2']) : ( ( isset($_POST['ARG2']) ) ? ($_POST['ARG2']) : 0) ;
$year = ( isset($_GET['ARG3']) ) ? ($_GET['ARG3']) : '';


Which should the send the page to
Code:


} else if (($mode == 'export') &&(( $userdata['user_level'] == ADMIN ))){

echo "<pre>";
print_r($_POST);
print_r($_GET);
echo "</pre>";
exit();


So I can see what is posted but the page just refreshes.
 
evaders99







PostPosted: Wed Aug 20, 2008 11:28 am Reply with quote

It depends on how append_sid is written. My guess is to stick another hidden variable sid
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> JavaScript

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©