need to insert a variable from 1 page in2 the database fr...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gasoga
Forum Commoner
Posts: 36
Joined: Thu Apr 17, 2003 4:15 am
Location: Ireland

need to insert a variable from 1 page in2 the database fr...

Post by gasoga »

Hi ,
I will try and explain this as best i can!!!

So when a user logs on they see the inbox of their mail , to veiw a new mail they click on the mail id, and this opens the mail:

i was told to do this i have to send the vairable through the link like so

Code: Select all

<?php
<A HREF='veiw.php?MailKey=$Call_ID'>$Call_ID</A>

?>
on the page where you can see the whole email you a given an option to assign this mail, you click on this link :
<a href = 'DeftCallLog.php?MailKey=$Call_ID'><b>Assign Mail</b></a>
and it will bring you to a page where you can enter the details of the mail into the data base and assign certain ppl to this mail,
The problem is when i insert the info i want to be able to to insert tha MailKey aswell but it doesnt work!!

I dont know if this makes sense to any one but if it does any suggestions would be really appreciated!!!
Thanx!!
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

What code are you using to insert the data into the database?
User avatar
delorian
Forum Contributor
Posts: 223
Joined: Sun May 04, 2003 5:20 pm
Location: Olsztyn, Poland

Post by delorian »

You want to have MailKey's value equal $Call_ID string. Or the $Call_ID has the value e.g. 34 you want to parse to MailKey :?: Try to use double quotes instead of single qoutes.
gasoga
Forum Commoner
Posts: 36
Joined: Thu Apr 17, 2003 4:15 am
Location: Ireland

Post by gasoga »

Code: Select all

<?php
$Q03 = "INSERT INTO $dblog VALUES('$PK_Call_ID','$MailKey','$emp_username','$cust_username','$company_name',SYSDATE(),'$call_type','$description','$priority')";
$R03 =  mysql_query($Q03) or die("Bad Q03:".mysql_error()); 

?>
Is the code to insert into the database

What happens is the link

Code: Select all

<?php
<a href = 'DeftCallLog.php?MailKey=$Call_ID'><b>Assign Mail</b></a>

?>
goes to a form page which when fills out is actioned to another page which uses the above code to insert into the database.
I can get the value i want to the form page by the above link but cant get it to the other page to insert it into the database. I have been tryin to do this with the following piece of code:

Code: Select all

<?php

<FORM METHOD ='POST' ACTION ='addNewCall.php?MailKey=$MailKey '>



?>
Is this any clearer?]

The call id has the value and i want to parse it to MailKey...
User avatar
delorian
Forum Contributor
Posts: 223
Joined: Sun May 04, 2003 5:20 pm
Location: Olsztyn, Poland

Post by delorian »

gasoga wrote:The call id has the value and I want to parse it to MailKey
So you cannot use

Code: Select all

<?php 
<a href = 'DeftCallLog.php?MailKey=$Call_ID'><b>Assign Mail</b></a> 
?>
but

Code: Select all

<?php 
echo "<a href = 'DeftCallLog.php?MailKey=".$Call_ID."'><b>Assign Mail</b></a>"; 
?>
the same with the <form action...

' ' - quotes everything like it is; " " quotes everything but variables. So it is a must to use " " here :D
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It would be better to use:

Code: Select all

<?php 
echo '<a href = "DeftCallLog.php?MailKey='.$Call_ID.'"><b>Assign Mail</b></a>'; 
?>
instead of

Code: Select all

<?php 
echo "<a href = 'DeftCallLog.php?MailKey=".$Call_ID."'><b>Assign Mail</b></a>"; 
?>
so that the HTML attributes are quoted using double quotes.

Mac
Post Reply