need help with generating html source from the php

This is a discussion on need help with generating html source from the php within the PHP Language forums, part of the PHP Programming Forums category; Hi every body, I need your help in a problem am facing, I have two forms on my website which ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-26-2007
shror
 
Posts: n/a
Default need help with generating html source from the php

Hi every body,

I need your help in a problem am facing,
I have two forms on my website which when submitted they goto single
page (confirmation.php) and the two forms are for English and Arabic
versions and what I want to do is to create a single confirmation page
which is responsible to send the forms values.
What I want to do is that when the arabic form is submitted the
confirmation echos arabic succesful note and when english an english
successful note is echoed which is easy to do but my problem is that
the <head> section of the confirmation contains a redirection meta tag
for the home page and I want the meta tag to be generated according to
the language interface, and I dont know how to generate HTML using the
php so please if anybody could help me this will be really
appreciated.
or even to direct me to a tutorial for this situation.

Thanks for help in advance

shror

Reply With Quote
  #2 (permalink)  
Old 09-26-2007
macca
 
Posts: n/a
Default Re: need help with generating html source from the php

Me thinks you need to read up a bit on php. Try http://w3schools.com/php/default.asp

$language = 'Arabic';

if ($language == 'Arabic'){

echo "<html><head><title>Some HTML and Arabic stuff</title></head>";

} elseif ($language == 'English'){

echo "<html><head><title>Some HTML and English stuff</title></head>";

} else {

echo "You must choose a Language";

}

Regards,

Paul

Reply With Quote
  #3 (permalink)  
Old 09-26-2007
Jerry Stuckle
 
Posts: n/a
Default Re: need help with generating html source from the php

shror wrote:
> Hi every body,
>
> I need your help in a problem am facing,
> I have two forms on my website which when submitted they goto single
> page (confirmation.php) and the two forms are for English and Arabic
> versions and what I want to do is to create a single confirmation page
> which is responsible to send the forms values.
> What I want to do is that when the arabic form is submitted the
> confirmation echos arabic succesful note and when english an english
> successful note is echoed which is easy to do but my problem is that
> the <head> section of the confirmation contains a redirection meta tag
> for the home page and I want the meta tag to be generated according to
> the language interface, and I dont know how to generate HTML using the
> php so please if anybody could help me this will be really
> appreciated.
> or even to direct me to a tutorial for this situation.
>
> Thanks for help in advance
>
> shror
>


<?php
echo "<b>This text is bold</b>\n";
?>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #4 (permalink)  
Old 09-27-2007
shror
 
Posts: n/a
Default Re: need help with generating html source from the php

On Sep 26, 10:30 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> shror wrote:
> > Hi every body,

>
> > I need your help in a problem am facing,
> > I have two forms on my website which when submitted they goto single
> > page (confirmation.php) and the two forms are for English and Arabic
> > versions and what I want to do is to create a single confirmation page
> > which is responsible to send the forms values.
> > What I want to do is that when the arabic form is submitted the
> > confirmation echos arabic succesful note and when english an english
> > successful note is echoed which is easy to do but my problem is that
> > the <head> section of the confirmation contains a redirection meta tag
> > for the home page and I want the meta tag to be generated according to
> > the language interface, and I dont know how to generate HTML using the
> > php so please if anybody could help me this will be really
> > appreciated.
> > or even to direct me to a tutorial for this situation.

>
> > Thanks for help in advance

>
> > shror

>
> <?php
> echo "<b>This text is bold</b>\n";
> ?>
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


I read about php on w3schools but the problem is that what I
understood is that the echo is used t echo something to the user to
read so that if I used

$language = 'Arabic';
if ($language == 'Arabic'){
echo "<html><head><title>Some HTML and Arabic stuff</title></head>";
} elseif ($language == 'English'){
echo "<html><head><title>Some HTML and English stuff</title></head>";
} else {
echo "You must choose a Language";
}

then I get on the page:
<html><head><title>Some HTML and English stuff</title></head>

anyway thanks for your help every body

shror

Reply With Quote
  #5 (permalink)  
Old 09-27-2007
shror
 
Posts: n/a
Default Re: need help with generating html source from the php

On Sep 26, 10:21 pm, macca <ptmcna...@googlemail.com> wrote:
> Me thinks you need to read up a bit on php. Tryhttp://w3schools.com/php/default.asp
>
> $language = 'Arabic';
>
> if ($language == 'Arabic'){
>
> echo "<html><head><title>Some HTML and Arabic stuff</title></head>";
>
> } elseif ($language == 'English'){
>
> echo "<html><head><title>Some HTML and English stuff</title></head>";
>
> } else {
>
> echo "You must choose a Language";
>
> }
>
> Regards,
>
> Paul


I tried your example Paul and It worked great I really feel as dumb
but I have a small problem I don't know why it happened, I have
created a page using notepad and saved it .php and Unicode, but when I
tested it online it was not working so I Saved it as ANSI and tested
it once more and the code worked correctly why is this happening

Thanks for help in advance and the previous help too

shror

Reply With Quote
  #6 (permalink)  
Old 09-27-2007
Sanders Kaufman
 
Posts: n/a
Default Re: need help with generating html source from the php

"shror" <shahirwm@gmail.com> wrote in message
news:1190829223.398719.48620@22g2000hsm.googlegrou ps.com...
> Hi every body,
>
> I need your help in a problem am facing,
> I have two forms on my website which when submitted they goto single
> page (confirmation.php) and the two forms are for English and Arabic
> versions and what I want to do is to create a single confirmation page
> which is responsible to send the forms values.


> What I want to do is that when the arabic form is submitted the
> confirmation echos arabic succesful note and when english an english
> successful note is echoed which is easy to do but my problem is that
> the <head> section of the confirmation contains a redirection meta tag
> for the home page and I want the meta tag to be generated according to
> the language interface, and I dont know how to generate HTML using the
> php so please if anybody could help me this will be really
> appreciated.
> or even to direct me to a tutorial for this situation.


That's difficult to impossible to say - without seeing the code.
I think it boils down to one comment - "I don't know how to generate HTML".

You could probably resolve your issue by finding the place in the code where
the META tag is generated and then to use a conditional (if-the-else) to
generate the appropriate line.


Reply With Quote
  #7 (permalink)  
Old 09-27-2007
Jerry Stuckle
 
Posts: n/a
Default Re: need help with generating html source from the php

shror wrote:
> On Sep 26, 10:21 pm, macca <ptmcna...@googlemail.com> wrote:
>> Me thinks you need to read up a bit on php. Tryhttp://w3schools.com/php/default.asp
>>
>> $language = 'Arabic';
>>
>> if ($language == 'Arabic'){
>>
>> echo "<html><head><title>Some HTML and Arabic stuff</title></head>";
>>
>> } elseif ($language == 'English'){
>>
>> echo "<html><head><title>Some HTML and English stuff</title></head>";
>>
>> } else {
>>
>> echo "You must choose a Language";
>>
>> }
>>
>> Regards,
>>
>> Paul

>
> I tried your example Paul and It worked great I really feel as dumb
> but I have a small problem I don't know why it happened, I have
> created a page using notepad and saved it .php and Unicode, but when I
> tested it online it was not working so I Saved it as ANSI and tested
> it once more and the code worked correctly why is this happening
>
> Thanks for help in advance and the previous help too
>
> shror
>


Maybe because PHP is an ANSI language?

You don't need to save a file as unicode to send unicode to the browser.
And, in fact, if you do, you'll get other problems.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #8 (permalink)  
Old 09-27-2007
Shelly
 
Posts: n/a
Default Re: need help with generating html source from the php


"Sanders Kaufman" <bucky@kaufman.net> wrote in message
news:82NKi.37169$RX.8150@newssvr11.news.prodigy.ne t...
> "shror" <shahirwm@gmail.com> wrote in message
> news:1190829223.398719.48620@22g2000hsm.googlegrou ps.com...
>> Hi every body,
>>
>> I need your help in a problem am facing,
>> I have two forms on my website which when submitted they goto single
>> page (confirmation.php) and the two forms are for English and Arabic
>> versions and what I want to do is to create a single confirmation page
>> which is responsible to send the forms values.

>
>> What I want to do is that when the arabic form is submitted the
>> confirmation echos arabic succesful note and when english an english
>> successful note is echoed which is easy to do but my problem is that
>> the <head> section of the confirmation contains a redirection meta tag
>> for the home page and I want the meta tag to be generated according to
>> the language interface, and I dont know how to generate HTML using the
>> php so please if anybody could help me this will be really
>> appreciated.
>> or even to direct me to a tutorial for this situation.

>
> That's difficult to impossible to say - without seeing the code.
> I think it boils down to one comment - "I don't know how to generate
> HTML".
>
> You could probably resolve your issue by finding the place in the code
> where the META tag is generated and then to use a conditional
> (if-the-else) to generate the appropriate line.


An interesting question occurred to me. Using the if statement outlined
previously in this thread, what happens with the echo when the desired
language reads from right to left and not left to right? Is it simply that
the entire string is captured in the quotes and so appears on the screen as
right to left? If that is the case, then what happens with word wrap?
Wouldn't it then break at the beginning of the sentence rather than in the
middle? (I have only worked on English sites).

Shelly


Reply With Quote
  #9 (permalink)  
Old 09-27-2007
Sanders Kaufman
 
Posts: n/a
Default Re: need help with generating html source from the php

"Shelly" <sheldonlg.news@asap-consult.com> wrote in message
news:13fnapid7bhrdb9@corp.supernews.com...
> "Sanders Kaufman" <bucky@kaufman.net> wrote in message


>> You could probably resolve your issue by finding the place in the code
>> where the META tag is generated and then to use a conditional
>> (if-the-else) to generate the appropriate line.

>
> An interesting question occurred to me. Using the if statement outlined
> previously in this thread, what happens with the echo when the desired
> language reads from right to left and not left to right?


I tend to buffer my echos until a block is fully composed.
I think there's a bunch of "ob****" stuff in PHP for that, but I just use a
variable.

Thus, the answer to your question is to do it like this:
Code:
if($sLanguage == "english"){
$sMessage = "Good God, almighty!";
} else {
$sMessage = "Allah akbar!";
}
echo $sMessage;

> Is it simply that the entire string is captured in the quotes and so
> appears on the screen as right to left? If that is the case, then what
> happens with word wrap?


I don't understand the question.
You had me up until word-wrap.
When you echo a string, as shown - it spits the result out to std_out as
composed.
There's no word-wrap unless the client is doing something like that.
Does that help answer the question?


> Wouldn't it then break at the beginning of the sentence rather than in the
> middle? (I have only worked on English sites).


Huh? Not in any context I can think of.



Reply With Quote
  #10 (permalink)  
Old 09-27-2007
macca
 
Posts: n/a
Default Re: need help with generating html source from the php

Never worked with anything but English but I do know that text
direction can be controlled with CSS e.g.

p {
direction:rtl;

text-align:right
}

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:34 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0