Place specific image in html page when specific name is typed.


Posted on 16th Feb 2014 07:03 pm by admin

Hello,

Fairly new to PHP and was curious if someone might know how to solve a fairly simple request.

I am currently passing the name of an end user (who types their name in a form field) to a URL which is then passed along and placed into an html page to personalize the page for them to print. Is there a way that I could use PHP to use a specific image for a specific name typed in the field?

Example would be:

Name typed in field: Bob
Picture used: Baseball

OR

Name typed in field: Alison:
Picture used: Cat

Below is some of the coder snippets I am using.



Here is the code from the form that the end user types in their name:

<form id="form1" name="form1" method="post" action="name_of_user.php">

<label>Gallery Name:<br />
<input type="text" name="name" id="name" />
</label>
<br />
<label>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
</form>

Here is the code that receives the post from above file:
<?php

$Name = Trim(stripslashes($_POST['Name']));

// redirect to success page
if ($success){
print "<meta http-equiv="refresh" content="0;URL=path to file/comp_pass_exhibitor.php?name=$Name">";
}
else{
print "<meta http-equiv="refresh" content="0;URL=path to file/comp_pass_exhibitor.php?name=$Name">";
}
?>


________Below is code from the html page I want personalised_______

Here is the bit of code that places the name in the html page:
<p><strong>
<span style="text-transform:uppercase;"><?php echo $_GET['name']; ?></span>

some text that doesn't change</strong> </p>

Here is the bit of code for the image on the html page:

<td>
<img src=" What would go here " width="140" height="109" align="left">
</td>



Any help would be appreciated

No comments posted yet

Your Answer:

Login to answer
82 Like 24 Dislike
Previous forums Next forums
Other forums

download directory onto C drive
I am attempting (if this is possible) to write a routine to automatically dump the contents of a dir

ImageCreate()
When I create an image and add text to it I want my text to be replaced with a PNG image, because th

help me, how to find text on an external html site using PHP
Would anyone know how to search an external html file for a work or phrase ?

I was thinking s

order by date not ID number help php
I am trying to orginize the following code to order by date not id number.
any help would be grea

Need help to modify php ELSE code
I'm trying to find a way to have the php code display a message if there is no inventory listed in t

first id from db not showing
I have a php script which displays the content of a mysql table as a html table with sorting, delete

Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno

array & querys help/advice.
Ok so here goes , I have a mysql database and basically here's what I need to do.

// foreach

Not capturing all the information we require in the form.......
Hi Guys,

I was wondering if you would share some more of your knowledge today, I'm hoping it

Can anyone give me some link on .htaccess tutorial
i wish to have friendly url using .htaccess, but no idea yet about this

Hope that anyone cou

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash