LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-21-2010, 08:51 AM   #1
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
How to intersperse PHP with HTML again


Hi,
In my site, I have a "Make A Friend" link, which will lead to a page where the user has to input their username and password, to identify who they are. The link is like so: "makeafriendlogin.php?person=26", to identify the person who is going to *making* the friend. When the Submit button on the login page is clicked, the "person" argument has to be transmitted to the script that handles it (makefriend.php). This is how I'm going to lay out the "makeafriendlogin.php" script:

<form method="post" action="makefriend.php">
<input name="username" type="text>
<input name="password" type="password">
<?php
$person=$_POST['person'];
<input name="author" type="hidden" value="$person">
?>
<input type="submit" value="submit">
</form>




My probem is with the "<input name="author" type="hidden" value="$author">" line - unless I put it within <?php and ?> tags, the "$person" won't be parsed, but at the same time, it's HTML, not PHP.... so I can't figure out what to do. Should I put it in a "print" statement?

Can anyone help?


Apologies if it sounds like another thread of mine on the same topic, but I'm really getting confused about *this matter*.

Thanks.
 
Old 09-21-2010, 08:55 AM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
You are correct. The best way to handle that line is simply:

Code:
<input name="author" type="hidden" value="<?php echo $author; ?>">
Regards,

Alunduil
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to intersperse PHP with HTML resetreset Programming 4 09-15-2010 10:29 AM
html vs. php kotty Programming 13 11-28-2007 04:20 AM
html vs. php feder Programming 9 11-02-2007 08:45 AM
Apache rending php when filename is x.php.html mastahnke Linux - Server 6 01-22-2007 08:39 AM
html into php charnel Programming 7 08-30-2005 10:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration