Jump to content

passing php $POST elements through javascript to a 3rd page


fj1200

Recommended Posts

Sorry - probably another thick js question - but I'm stummped.  Not been on js for long and I'm not a programmer. 

 

I have a simple php form entering 5 fields into a MySQL db.  I now need to print off a form populated by those elements.  Printing is done by js and the page that does the db inserting has a  redirect in it.  Works ok - so far so good.....

 

link <rel=\"alternate\" media=\"print\" HREF=\"http://servername/note.php\"> with...

 

<script language="Javascript1.2">

<!--

function printpage(){

window.print(); }

//-->

</script>

<script language="javascript">

 

However on printing the page note.php has no data on it.  I have also tried using a sql query in an includefile for the page to be printed - I do this elsewhere - but need to pass one of the original elements to it for the query to work.  I could do the MAX(id) no. query on the db but eventually it will be multi-user and MAX(id) may be a different record if 2 get entered at the same time. 

 

Can I use $_POST data?  If so how - I can't get that to work either.  Is the js causing a problem in transfering the form elements through to the final printed form?

Hi fj1200,

    I think i understand what you're asking.  I had a similar problem trying to pass variables from one page to the next. Well there are two ways to do this.  either pass them in a using a form with hidden elements or pass them through a $_session ... but that would require you to have a session in your page.  I tried doing it via javascript but it's too complicated for me.  What I did was simply create a session..  and through the same session I passed any variable I wanted from one page to the next.

 

I hope I have helped in some way.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.