Web Design Forum: Contact form problem - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Contact form problem Rate Topic: -----

#1 User is offline   irn3rd 

  • Expert
  • PipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 512
  • Joined: 13-July 08
  • Reputation: 3
  • Gender:Male
  • Location:UK
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 01 August 2009 - 11:32 PM

Right,

I have a contact form,

There is a subject textbox on it and i have put the value as
<?php $_GET['subject']; ?>


now on the link to my contact page i have put ?page=contact&subject=Blog

I thought the &subject=Blog would allow the subject text box to be auto filled with "Blog" what have i done wrong?

many thanks
Ben
0

#2 User is offline   ElanMan 

  • In, out, shake it all about...
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 3,298
  • Joined: 11-March 08
  • Reputation: 54
  • Gender:Male
  • Location:Darlington
  • Experience:Nothing
  • Area of Expertise:Nothing

Posted 02 August 2009 - 12:14 PM

You need to echo it out.
<?php echo $_GET['subject']; ?>

But sanitise it first.
0

#3 User is offline   irn3rd 

  • Expert
  • PipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 512
  • Joined: 13-July 08
  • Reputation: 3
  • Gender:Male
  • Location:UK
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 02 August 2009 - 01:36 PM

View PostElanMan, on 02 August 2009 - 12:14 PM, said:

You need to echo it out.
<?php echo $_GET['subject']; ?>

But sanitise it first.


Ahh thank you,

thought it would be something simple ^_^

Ben
0

#4 User is offline   dt17 

  • Advanced Member
  • PipPipPip
  • View gallery
  • Group: Members
  • Posts: 450
  • Joined: 22-May 09
  • Reputation: 14
  • Gender:Male
  • Location:Scotland
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 02 August 2009 - 01:48 PM

If your server supports short tags, you can use the <?= and ?> tags.

Sometimes it's not the best cause if you switch servers and the new one doesn't support them, you'd have to change them, but otherwise, they are useful

<?= $_GET['subject'] ?>
0

#5 User is offline   skidz 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,047
  • Joined: 24-November 08
  • Reputation: 135
  • Gender:Male
  • Location:Derby
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 03 August 2009 - 12:45 PM

View Postdt17, on 02 August 2009 - 01:48 PM, said:

If your server supports short tags, you can use the <?= and ?> tags.

Sometimes it's not the best cause if you switch servers and the new one doesn't support them, you'd have to change them, but otherwise, they are useful

<?= $_GET['subject'] ?>



Hate to be a contradictor but its generally bad practise to use short tags
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users