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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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