Cgi/php help?
Hi, can anyone help - I'm looking to set up an online
shopping basket on my web site with multiple options for each
product eg. t-shirt - style logo - personalised with name - shirt
colour - size etc. I will only be selling six different products in
total so I don't want anything too over the top.
Is there a PHP/CGI script or shopping basket program that
will allow a customer to make their choices by clicking a radio
button by each option required and then preview the outcome in a
pop-up window or a new page eg. red t-shirt with fish logo on the
front and personalised with a name eg. Matthew, before they make
their purchase?
Any help appreciated
Cheers
Here is a simple bit of PHP to stick in the page your form posts to. You would need to edit the first three variables to your liking, and add the html you want to serve afterwards:
<pre>
<?php
$emailFrom = '[email protected]';
$emailTo = '[email protected]';
$emailSubject = 'Subject';
$date = date('l, \t\h\e dS \o\f F, Y \a\t g:i A');
$browser = $HTTPSERVER_VARS['HTTP_USERAGENT'];
$hostname = $HTTPSERVER_VARS['REMOTEADDR'];
$message = "$date\n\nAddress: $hostname\nBrowser: $browser\n\n";
foreach ($_POST as $key => $value) {
$message .= $key . ": " . $value . "\n";
$mailResult = mail($emailTo,$emailSubject,$message,"From: $emailFrom");
?>
</pre>
This script will grab the server's date and the submitter's address and browser type. It will then list the name and value of each form field you have put on your form.
Also, this script expects your form method="post".
Lastly, you can offer alternate text later on in your html page based on the success of the above script with a snippet like this:
<pre><?php
if ($mailResult) {
echo "Your comments have been received thank you.";
} else {
echo "There was an error. Please try again or contact us using an alternate method.";
?></pre>
Similar Messages
-
Php-cgi php not same version still works?
Maybe this post should have gone in the Package issues forum, but I thought more people would know about that kind of thing in this forum.
Anyways, I noticed that php-cgi was at version 5.2.1 and php main package is at 5.2.2. If i'm using lighttpd does this combination still work? Or should I flag php-cgi out of date?
I don't have much experience with php and php-cgi itself, I just set up my lighttpd server to support php through fcgi.Well after the new php version got updated I tried to upgrade and it said that it conflicts with php-cgi. Obviously I couldn't know at that point that php now includes the php-cgi binary. So I created this post after I decided to cancel the upgrade process because I thought the conflict means that old php-cgi doesn't work with new php package.
Well now I just let it upgrade and it works (it even shows the cgi php.ini advise - but that doesn't completely tell that cgi is included; of course I could have gone for trial and error, but I didn't want to risk that on my server).
Thanks again for sorting this out. -
Is it possible to execute a ASP/CGI/PHP script thru sockets?
hi,
i was wondering whether it is possible in Java to pass data and execute ASP/CGI/PHP script on demand thru sockets (suppose a port has been specified by both sides) and how? i know this is possible thru the urlConnection, but how about sockets? these scripts could be stored in specific directories on the server.
thanks!!!hi,
i was wondering whether it is possible in Java to pass
data and execute ASP/CGI/PHP script on demand Yes, completely it's possible!
If you need to access ASP/CGI/PHP/Servlet/JSP thru' Java program, you can refer:
http://developer.java.sun.com/developer/qow/index.jsp
[after a week: http://developer.java.sun.com/developer/qow/archive/index.html
and look for 'Can I send an HTTP request to a servlet from a normal class without having to use a browser to send the HTTP requests?']
-and that's the QOW [Question Of the Week]!
thru sockets (suppose a port has been specified by both
sides) and how? When you say, a port has been specified on both sides,
then it becomes, a NET/Socket programming and you
need to use the 'net' package for the same.
i know this is possible thru the urlConnection, 'possible' means, it's assumed that u're invoking the 'script' thru' a web-server!
And u still use 'http://...' protocol to achieve the same; and u're NOT
directly accessing the script file as "file:\\network-host\root\files\abc.jsp"
but how about sockets? these scripts
could be stored in specific directories on the
server.It's not at all possible to 'invoke' those 'scripts' directly, by
using sockets; If you know that they're existing in one
particular directory of a network system, all you can do is
you can read the file content thru' socket, but you can't
make it become 'alive' and it would not dance for u!
Because, if there is a 'script' [PHP/ASP/CGI/JSP] that is
meant for dancing, then the stage for dancing is provided
by the web-server environment which starts the appropriate
server-side process that can understand and interpret the
given script! And all we can do is asking the web-server
to pull the 'script' to the stage and dance for you! But,
the 'asking' the webserver can be done thru' browser or
a URLConnection! If what you want to do would have been
possible, then, just with FTP we could have achieved the same!
Easy Go Jolly Java!
-RK -
ZEND/Flex - amf-config.php help!!
Have some odd behavior taking place when promoting release builds to my production server.
I have two projects one works - one does not. Both the same settings as far as I can tell.
Using the amf-config.ini file - this test works
[zend]
;set the absolute location path of webroot directory, example:
;Windows: C:\apache\www
;MAC/UNIX: /user/apache/www
;webroot =C:/Program Files/Zend/Apache2/htdocs
webroot = ../../
;set the absolute location path of zend installation directory, example:
;Windows: C:\apache\PHPFrameworks\ZendFramework
;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework
;zend_path =
[zendamf]
amf.production = false
amf.directories[]=xyz/release/services
The next release uses the same gateway and amf-config files - and I get this error.
Class "XYZservice" does not exist: Plugin by name 'XYZservice' was not found in the registry; used paths: : /xyz/release/services/
#0 /var/www/vhosts/xyz.com/httpdocs/ZendFramework/library/Zend/Amf/Server.php(550): Zend_Amf_Server->_dispatch('secure', Array, 'XYZservice')
#1 /var/www/vhosts/xyz.com/httpdocs/ZendFramework/library/Zend/Amf/Server.php(626): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
#2 /var/www/vhosts/xyz.com/httpdocs/xyz/release/gateway.php(69): Zend_Amf_Server->handle()
#3 {main}
Have tried many variations - but still no joy. Why does ../../ work and not the direct path? - by the look of it, those directory's are fine.
As I understand it - no matter what set-up you build on (local Windows) and promote to a hosted production server (US, mediatemple) - as long as you configure the amf-config.ini file all should be good. Is this the case? Am I missing something when I do a release build.
Am I better of specifying the "endpoint" in all my service calls in my declarations (mxml code)?
Been going round in circles with this for several months now. Getting to the point where the only way I can deploy is Windows. DO NOT want to go down that road.
Help is much appreciated.
rgds
martin6 Hours of headache later I solved this problem!
So in my case the amf_config.ini was set up correctly with webroot=/fullpath/to/url/root and amf.service=foldername (php in my case)
on my local machine the services file is product.php and everything is groovy and working
I uploaded everything exactly as it is on my machine and got the error you did.
I simply cp product.php to Product.php and it worked
For somereason the zend framework is looking for a file that starts with a capital letter!!!! even though it works fine on my machine and was referenced as product.php! Are you kidding me? What a headache.
Joel -
Hi guys,
Long time, no see! ;-)
Anyway, I've got a question for someone who is pretty darn
good with PHP,
forms, and MySQL. This is ultimately what I need to achieve:
I'm creating a webpage for my university that will allow the
professors in
the IST department to select their preferences in course
choices. I want to
list out each IST course and then give them two different
things to do with
each course. The first thing is they need to select if
they've taught that
IST course before. Secondly, they need to say whether they
"don't want to
teach" the course, are "willing to teach" the course, or
"really want to
teach" the course. OK, hope this makes sense so far. What I
need help with
is figuring out how to put all the choices for each categorey
into one field
in a MySQL database. For example, if they selected the "don't
want to teach"
option (I'm not sure if a drop-box or radio button would work
best...) for
IST 215, IST 110 and IST 230. How can I have those courses
entered into the
single database field called "dontwant?"
This is my code so far:
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or
die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get values from form
$name=$_POST['name'];
$thedate=date('m-j-y');
$taughtbefore=;
$dontwant=;
$willing=;
$reallywant=;
$comments=!trim($_POST['comments']);
// Insert data into mysql
$sql="INSERT INTO $tbl_name(name, thedate, taughtbefore,
dontwant,
willing, reallywant, comments)VALUES('$name', '$thedate',
'$taughtbefore',
'$dontwant', '$willing', '$reallywant', '$comments')";
$result=mysql_query($sql);
// close connection
mysql_close();
Is there a way I can like...append all these values into one
string to pass
into the single database field...? As you can see, I really
don't know how
or what values to assign to those empty strings up there...
I'm really
unsure of how to go about doing this. I hope this makes
sense...
Thanks for any and all of your time!
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Blog:
http://avenuedesigners.com/blog/
Web dev articles, photography, and more:
http://sourtea.com
=============================================
Proud GAWDS member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================Hi Murray,
Allow me to clarify. I ultimately need to display something
like this...and
this would be reading from the MySQL database, and output in
a table on the
webpage:
| No Teach | Want to Teach | Really want |
| IST 250 | IST 420 | IST 330 |
| IST 110 | IST 101 | IST 311 |
| IST 332 | | IST 120 |
| | | IST 440
|
I understand your approach and think it's a good idea. I
guess I should have
a table for each, like: NoTeach, WantToTeach, and ReallyWant.
My question is
how I would put the right IST course into the right table.
Like if they
selected "I don't want to teach" would I have some type of if
statement to
sort them into the right tables? If so, can you give me some
code on how it
would work?
Thanks!
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Blog:
http://avenuedesigners.com/blog/
Web dev articles, photography, and more:
http://sourtea.com
=============================================
Proud GAWDS member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================
"Murray *ACE*" <[email protected]> wrote
in message
news:[email protected]...
> Why would you want to put all of that into a single
field? Sounds like
> the wrong approach to me....
>
> I'd have a NoTeach table, containing at least three
fields -
>
> termDate
> profID
> classID
>
> Each professor's "noteach" selection would then be a
separate record in
> that table, which could all be collated for display....
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
> ==================
>
>
> "Shane H" <[email protected]> wrote
in message
> news:[email protected]...
>> Hi guys,
>>
>> Long time, no see! ;-)
>>
>> Anyway, I've got a question for someone who is
pretty darn good with PHP,
>> forms, and MySQL. This is ultimately what I need to
achieve:
>>
>> I'm creating a webpage for my university that will
allow the professors
>> in the IST department to select their preferences in
course choices. I
>> want to list out each IST course and then give them
two different things
>> to do with each course. The first thing is they need
to select if they've
>> taught that IST course before. Secondly, they need
to say whether they
>> "don't want to teach" the course, are "willing to
teach" the course, or
>> "really want to teach" the course. OK, hope this
makes sense so far. What
>> I need help with is figuring out how to put all the
choices for each
>> categorey into one field in a MySQL database. For
example, if they
>> selected the "don't want to teach" option (I'm not
sure if a drop-box or
>> radio button would work best...) for IST 215, IST
110 and IST 230. How
>> can I have those courses entered into the single
database field called
>> "dontwant?"
>>
>> This is my code so far:
>>
>> // Connect to server and select database.
>> mysql_connect("$host", "$username", "$password")or
die("cannot
>> connect");
>> mysql_select_db("$db_name")or die("cannot select
DB");
>>
>> // Get values from form
>> $name=$_POST['name'];
>> $thedate=date('m-j-y');
>> $taughtbefore=;
>> $dontwant=;
>> $willing=;
>> $reallywant=;
>> $comments=!trim($_POST['comments']);
>>
>> // Insert data into mysql
>> $sql="INSERT INTO $tbl_name(name, thedate,
taughtbefore, dontwant,
>> willing, reallywant, comments)VALUES('$name',
'$thedate',
>> '$taughtbefore', '$dontwant', '$willing',
'$reallywant', '$comments')";
>> $result=mysql_query($sql);
>>
>> // close connection
>> mysql_close();
>>
>>
>> Is there a way I can like...append all these values
into one string to
>> pass into the single database field...? As you can
see, I really don't
>> know how or what values to assign to those empty
strings up there... I'm
>> really unsure of how to go about doing this. I hope
this makes sense...
>>
>> Thanks for any and all of your time!
>>
>>
>> --
>> Shane H
>> [email protected]
>>
http://www.avenuedesigners.com
>>
>> =============================================
>> Blog:
>>
http://avenuedesigners.com/blog/
>>
>> Web dev articles, photography, and more:
>>
http://sourtea.com
>> =============================================
>> Proud GAWDS member
>>
http://www.gawds.org/showmember.php?memberid=1495
>>
>> Delivering accessible websites to all ...
>> =============================================
> -
I have a site I have developed with Dreamweaver 8. The site
has a mix of pages - some with the .html and some with the .php. So
far everything works great. My home page was .html but I saved it
over to .php and updated all the links (Dreamweaver did all of this
for me). Now, I want to use some php code for a news feed. However,
I keep getting the following two errors:
Warning: main(): URL file-access is disabled in the server
configuration in /home/content/s/u/s/sl/html/BMT/index.php on line
139
Warning: main(
http://www.newsfeed.com/tools/steppatch_nc.asp?type=s&t=test&prov=keywords&cat=Business&ca t2=&num_articles=5&show_summaries=Yes&show_sources=No&show_dates=No&title=undefined&keywor ds=B%20Lns&url=&headers_size=12pt&title_size=10pt&title_bold=Yes&font_size=10pt&font_famil y=Arial&text_alignment=Left&space=Yes&titlecolor=%23000000&fcolor=%23000000&desccolor=%230 00000&sourcecolor=%230000FF&datecolor=%23999999):
failed to open stream: no suitable wrapper could be found in
/home/content/s/u/s/sl/html/BMT/index.php on line 139
Line 139 is the closing tag of the php code.
Can anyone help?quote:
Originally posted by:
brywilson88
Warning: main(): URL file-access is disabled in the server
configuration in /home/content/s/u/s/sl/html/BMT/index.php on line
139
Warning: main(
http://www.newsfeed.com/tools/steppatch_nc.asp?type=s&t=test&prov=keywords&cat=Business&ca t2=&num_articles=5&show_summaries=Yes&show_sources=No&show_dates=No&title=undefined&keywor ds=B%20Lns&url=&headers_size=12pt&title_size=10pt&title_bold=Yes&font_size=10pt&font_famil y=Arial&text_alignment=Left&space=Yes&titlecolor=%23000000&fcolor=%23000000&desccolor=%230 00000&sourcecolor=%230000FF&datecolor=%23999999):
failed to open stream: no suitable wrapper could be found in
/home/content/s/u/s/sl/html/BMT/index.php on line 139
Directly accessing URL's is forbidden on your server.
Therefore you cannot pass a URL as an arguement to a function. This
is a common security setting and you will probably need to use CURL
to get the data from the external URL and then pass the input to
main(). -
Almost there, still need email php help!
Hey there everyone,
I posted my issue earlier but the thread seems to be dead. I have been researching php syntax and looked at some other examples online, and I think I almost have it. I just need a little extra assistance to get there.
I had my php page partially working earlier, and I was receiving emails from my form submission, but all the data I got was subject and phone number. I didn't get my thank you page to come up either. My form has fields for name, email, phone, 3 comment fields and 3 reference fields. Not sure why I wasn't getting all of the data so I tried redoing my code.
Now, after redoing the code, I get my thank you page to come up, but I don't get any email notification with the submitted data anymore. I am not sure why. I had some code syntax errors but I fixed them through process of elimination and I have no syntax errors now.
Would someone be able to take a look at my files and tell me what I am doing wrong? I am always ready to put in work and test through trial and error, but I just am not sure where to start. I am so close!!!
Thanks for reading and for any advice, I really appreciate it!
JaysonDavid, thank you! It works! You are my new hero!
Well, through it all I learned a lot about syntax, headers, form security, etc etc Very helpful! Even learned about bare LF's lol.
I am trying to also have the thank you page redirect to the manufacturer's page after 5 seconds, and I did some reading about redirect code through meta and php. Not sure if it matters which one I use, and I am also confused about where to put it.
These are what I found:
<head>
<meta http-equiv="refresh" content="5; URL=thankyou.htm">
</head>
<?php
header("refresh: 5; thankyou.htm";
?>
If I use the meta tag, does it go directly in the code on the thank you page? And if I use the pgp code, where does that go? I tried it but the page was having trouble redirecting.
Thanks again for all of your help, and if you feel generous enough to help me with this too I would really appreciate it!
Jayson -
Dreamweaver and PHP Help Needed!
If there is anyone out there who can help, I am working with
a back-end secured website that is in php and need to manipulate
and change pageson-the-fly. I'm not sure how to view and actually
see in Design View my PHP page, as I can best work in Design View.
Can anyone help out there?
The website I need help with is
http://www.businesscreditbuilder.com
Help needed as soon as possible...
Thank you...
If you want to help, I can compensate you for helping with an
immediate page..Thank you for writing. I do need your help, and here's the
scenario. I work for a company that deals with business credit. In
the previous post at
http://www.businesscreditbuilder.com
there is a login. Once logged in, there is a home page for the
members. That first page I need to change as soon as possible for
over 40,000 members. All the members will see the same home page
inside the members area. You're welcome to login as "makaiman",
password is "1143mak" to see the first page that comes inside the
members area I need to change just a little. PHP is installed on a
remote server running on Windows. I need help or guidance on this
immediately but I have to sleep right now as it is 1130pm pacific
and need to have this done by sometime tomorrow morning. I
appreciate all of your help so very much... any advice would be so
much appreciated...
m -
I am working on a mail form that is linked to my payroll
system. It is working great but there has been a request that I add
a mail to all recipients feature. However I am not to sure how I
would go about doing this, I am hoping someone can help me atler my
current code. Right now the recipient selction is a drop down menu
that is populated from a mySQL table within my payroll system.
I would like the first option when dropped down to be "All
Recipents" so when it is sent the mail is sent to everyone's email
not just the slected individual email.
Below is the current code I have where only one recipent can
be selected.
Thanks in advance!Does your e-mail system support Distribution Lists? If so,
the easiest way
would be to add the appropriate one to your Dropdown list.
If not, then the only other way I see to do this is to check
whether "All
Recipients" is selected. If it is, loop through all of the
addresses and
build up the BCC: string (it's considered a bad practice to
put huge lists
in the TO: field). If not, then use your current code.
HTH
Steve
"bcounts" <[email protected]> wrote in
message
news:[email protected]...
>I am working on a mail form that is linked to my payroll
system. It is
>working
> great but there has been a request that I add a mail to
all recipients
> feature.
> However I am not to sure how I would go about doing
this, I am hoping
> someone
> can help me atler my current code. Right now the
recipient selction is a
> drop
> down menu that is populated from a mySQL table within my
payroll system.
>
> I would like the first option when dropped down to be
"All Recipents" so
> when
> it is sent the mail is sent to everyone's email not just
the slected
> individual
> email.
>
> Below is the current code I have where only one recipent
can be selected.
>
> Thanks in advance!
>
>
>
> ******* HTML CODE *********
> <?
> include('auth.php');
> $user_id = $_GET['user_id'];
> $result = mysql_query("select * from user_info where
user_id = $user_id");
> $row = mysql_fetch_array($result);
> ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
> "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="
http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
> <title>Untitled Document</title>
> </head>
> <body>
> <input type="hidden" name="user_id"
value="<?=$user_id?>" />
> <form method="post" action="send_mail.php">
> <table bgcolor=#ffffcc align=center>
> <tr><td><font color=red>*</font>
Name:</td><td><input name="Name"
> value="<?=$row['fname']?>
<?=$row['lname']?>" size=25></td></tr>
> <tr><td><font color=red>*</font>
Email:</td><td><input name="Email"
> value="<?=$row['user_email']?>"
size=25></td></tr>
> <tr>
> <td><font color=red>*</font>
Recipient:</td>
> <td align="left"><select name="sendto">
> <option value="">Select Recipient . .
.</option>
> <?php $sql = mysql_query("SELECT * FROM user_info
ORDER BY lname ASC");
> while
> ($row1 = mysql_fetch_array($sql)) { ?>
> <option value="<?php echo $row1['user_email'];
?>"><?php echo
> $row1['fname'];
> ?> <?php echo $row1['lname']; ?></option>
> <?php } ?>
> </select></td></tr>
> <tr>
> <td><font color=red>*</font>
Subject:</td>
> <td><input size=25
name="Subject"></td></tr>
> <tr><td
colspan=2>Message:</td></tr>
> <tr><td colspan=2 align=center><textarea
name="Message" rows=5
> cols=35></textarea></td></tr>
> <tr><td colspan=2 align=center><input
type=submit name="send" value="Send
> Mail"></td></tr>
> <tr>
> <td colspan=2 align=center><small><font
color=red>*</font> Indicates
> Required
> Field</small></td>
> </tr>
> </table>
> </form>
> </body>
> </html>
>
> ******* PHP CODE *********
>
> <?php
> $to = $_REQUEST['sendto'];
> $from = $_REQUEST['Email'];
> $name = $_REQUEST['Name'];
> $headers = "From: $from";
> $subject = $_REQUEST['Subject'];
>
> $fields = array();
> $fields{"Message"} = "Message";
>
> $body = ""; foreach($fields as $a => $b){ $body .=
sprintf("%20
> %s\n\n",$b,$_REQUEST[$a]);}
>
> if($from == '') {print "You have not entered an email,
please go back and
> try
> again";}
> else {
> if($subject == '') {print "You have not entered a
subject, please go back
> and
> try again";}
> else {
> $send = mail($to, $subject, $body, $headers);
> if($send)
> {header( "Location: index.php" );}
> else
> {print "You did not choose a recipient or the recipent
you have chosen did
> not
> have an email on file.";}
> }
> }
> ?>
> -
Hi, I'm new to PHP, currently the following sets the end date
to the start date:
function afterSetDateValue(ref_field, target_field, date) {
if (date!="") {
var startDate=document.forms[0]["start_date"];
var endDate=document.forms[0]["end_date"];
if (target_field==startDate &&
checkDate(getDateValue(endDate))==0 &&
compareDates(date, getDateValue(endDate))>0) {
setDateValue(endDate, date);
("End Date was earlier than Start Date, it's now set to
Start Date.");
How do I make it so that if the start date is changed to a
date later than the end date, the end date is start date + 1? I'm
sure its a simple PHP, but like i said i'm learning!
Thanksferrarikid123 wrote:
> How do I make it so that if the start date is changed to
a date later than
> the end date, the end date is start date + 1? I'm sure
its a simple PHP, but
> like i said i'm learning!
It's not PHP at all. The script you have shown is JavaScript.
It's also
incomplete. You might get more help if you describe in more
detail
exactly what it is you're trying to do.
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/ -
hey, basic what i would like,,
is a text box, form whatever. that when something is written
then submitted it will insert this data into page, but i would need
several boxs, with multi submit, every box has a seperate cell.
also the current data will be erased.. thankyou
please help
danny
http://www.habboradio1.comThen use the php filesystem functions:
http://www.php.net/manual/en/ref.filesystem.php -
Hey everyone -
I have a quote form on my website that I'd like to tweak a
bit. There are
some fields that have a drop-down box of "Yes" or "No" and
directly after
that it says, "If Yes, ..." So, no matter which option is
chosen, the user
still sees that even if it doesn't apply to them - which I'm
OKAY with for
the time being, but wish to implement it differently.
If the user selects "Yes" - I'd like the the field that says
the question I
*need* to ask the user if they choose "Yes." If they select
"No," than the
box is never shown. Sounds simple enough, right? Right ...
My concern is a). how to show this hide/don't hide
functionality, and b).
how to validate (require) the box being "shown" if they
choose "Yes" and to
NOT validate (require) if they choose "No."
I'm going to upload a .html file to my server that has the
full code for my
quote.php page in plain text, so someone can help me
implement this.
Quote source code:
http://www.avenuedesigners.com/tests/quote_source.html
I colored the big chunks of PHP code red, and the form blue
for ease.
I've tried something like this:
<?php
if ($_POST['havewebsite'] == "Yes") {
echo ('<p class="labelbold">If yes, What is the Domain
Name?</p>
<input name="currentdomain" type="text"
class="contactfield2 inputstyled"
id="currentdomain" value="<?php if
(isset($_POST[\'currentdomain\'])) echo
htmlentities($_POST[\'currentdomain\']);?>" tabindex="11"
/>');
?>
And run into two problems:
1. It only shows up when the page is submitted, and I'm
naturally assuming
this is because of the $_POST being in there. I need it to
display
immediately if they select "Yes."
2. It physically prints out: <?php if
(isset($_POST[\'currentdomain\']))
echo htmlentities($_POST[\'currentdomain\']);?> - as the
value of the
textfield instead of leaving it blank/printing the previously
entered text.
How can I fix these, guys? Thank you!
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Proud GAWDS Member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================you can apply a show-hide layer behavior to the YES check box
(onClick="MM_ShowHideLayers...)
and have the inverse show;hide behavior applied toi the NO
checkbox.
Once you have a Layer on your page and have applied the
behavior, you change that Layer into a
regular div by the way, just leave the same id.
Then, for validating the question only if yes is selected:
<?php
if ($_POST['have_a_website'] == 'yes' &&
empty($_POST['question'])){
$error = TRUE;
?>
Shane H wrote:
> Hey everyone -
>
> I have a quote form on my website that I'd like to tweak
a bit. There are
> some fields that have a drop-down box of "Yes" or "No"
and directly after
> that it says, "If Yes, ..." So, no matter which option
is chosen, the user
> still sees that even if it doesn't apply to them - which
I'm OKAY with for
> the time being, but wish to implement it differently.
>
> If the user selects "Yes" - I'd like the the field that
says the question I
> *need* to ask the user if they choose "Yes." If they
select "No," than the
> box is never shown. Sounds simple enough, right? Right
>
> My concern is a). how to show this hide/don't hide
functionality, and b).
> how to validate (require) the box being "shown" if they
choose "Yes" and to
> NOT validate (require) if they choose "No."
>
> I'm going to upload a .html file to my server that has
the full code for my
> quote.php page in plain text, so someone can help me
implement this.
>
> Quote source code:
>
http://www.avenuedesigners.com/tests/quote_source.html
>
> I colored the big chunks of PHP code red, and the form
blue for ease.
>
> I've tried something like this:
>
> <?php
> if ($_POST['havewebsite'] == "Yes") {
> echo ('<p class="labelbold">If yes, What is the
Domain Name?</p>
> <input name="currentdomain" type="text"
class="contactfield2 inputstyled"
> id="currentdomain" value="<?php if
(isset($_POST[\'currentdomain\'])) echo
> htmlentities($_POST[\'currentdomain\']);?>"
tabindex="11" />');
> }
> ?>
>
> And run into two problems:
>
> 1. It only shows up when the page is submitted, and I'm
naturally assuming
> this is because of the $_POST being in there. I need it
to display
> immediately if they select "Yes."
>
> 2. It physically prints out: <?php if
(isset($_POST[\'currentdomain\']))
> echo htmlentities($_POST[\'currentdomain\']);?> - as
the value of the
> textfield instead of leaving it blank/printing the
previously entered text.
>
> How can I fix these, guys? Thank you!
>
seb ( [email protected])
http://webtrans1.com | high-end web
design
Downloads: Slide Show, Directory Browser, Mailing List -
PHP Help with inherited database site
Hope someone can help with this, although I might be a bit vague. (But will be happy to post any code that might help.)
Basically I do a few sites for a company, and everything is coming together nicely moving everything to a new reseller hosting account where everything can site. I'm basically doing some redesign and new database work for them.
But there's one site I'm basically just trying to move over, that already has a database. I've copied the site onto the new hosting, copied the database across and created a new connection file.
I must admit the code is all a bit more PHPO heavy than what I'm used to working with. so have run into a problem trying to figure out what data is not displaying due to queries failing. As far as I can tell the connection is working, and the queries have not changed.
Anyway - the main page is here, where you should be able to click on the furniture images to go to the product page :
http://www.miradatravelmedia.com/lusty/public_html/index.php
But when you click through the product page query is failing :
http://www.miradatravelmedia.com/lusty/public_html/products.php?category=1
The products page is mostly PHP and looks like this :
[PHP]<?php
if (!@empty($_REQUEST["img"])) {
require_once("../includes/hft_image.php");
$img = new hft_image($_REQUEST["img"]);
$img->resize(200,180,"-");
$img->output_resized("");
exit;
$page = "products";
include("../includes/header.php");
include("../includes/db_open.php");
$sql = "SELECT `id`, `name` FROM `categories` WHERE `id` = '" . $_REQUEST["category"] . "'";
$result = mysql_query($sql) or die("Query failed : $sql at line " . __line__);
$category = mysql_fetch_assoc($result);
?>
<div id="trail"><a href="shop.php">Shop</a> > Lloyd Loom <?php echo $category["name"]?></div>
<div class="clear" id="divider1"><img src="images/spacer.gif" alt="<?php echo keyword()?>" /></div>
<h1>Lloyd Loom <?php echo $category["name"]?></h1>
<?php
$sql =
"SELECT * " .
"FROM `products` " .
"WHERE `category` = '" . $_REQUEST["category"] . "' " .
"ORDER BY `order`";
$result = mysql_query($sql) or die("Query failed : $sql at line " . __line__);
if (mysql_num_rows($result) == 0) {
?>
<p>Coming soon ...</p>
<?php
} else {
$n = 0;
while ($row = mysql_fetch_assoc($result)) {
$n++;
?>
<a href="product.php?id=<?php echo $row["id"]?>" class="product"<?php if ($n == mysql_num_rows($result)) echo " id=\"last\""?>>
<?php
if ($file = glob("images/products/" . $row["id"] . "_*.*")) {
?>
<img src="img.php?img=<?php echo $file[0]?>&width=200&height=180" alt="<?php echo $row["code"]?>" />
<?php
} else {
?>
<div id="no_image">No image found</div>
<?php
?>
<?php echo $row["code"]?>
</a>
<?php
if (is_int($n / 4)) {
?>
<div class="clear"><img src="images/spacer.gif" alt="<?php echo keyword()?>" /></div>
<?php
?>
<div class="clear" id="divider2"><img src="images/spacer.gif" alt="<?php echo keyword()?>" /></div>
<?php
include("../includes/footer.php");
?>[/PHP]
If anyone could shed any light on what's going wrong still, that would be much appreciated.
Thanks.Iain71 wrote:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''categories' WHERE 'id' = '1'' at line 1
So it does look a bit odd with the quotes.
Column names in a SQL query must not be in quotes. The MySQL error message tells you that the SQL syntax error is "near" the section it refers to. In other words, the error is just before that part of the query. Normally, you need to display the whole query to spot the error, but it's obvious in this particular case, because there's a quotation mark after categories, indicating that you've put the column name in quotes. Anyway, you've solved that problem by using the version I suggested.
I still haven't managed to establish where this vat.php file is - is there any explanation for it not being visible on the original hosting server where the site is working? And could it have anything to do with the query not working?
No, it has nothing to do with the query not working, and the reason you can't see it on the live site is because there's no error. The error message on your test site tells you exactly where to look for the problem. The file vat.php is included by header.php on line 19. Either vat.php isn't on your server, or the code on line 19 of header.php is pointing to the wrong location. -
I had set up my Apache and PHP via the terminal last year, and had it working properly in the browser under localhost. I stopped working with it for a year, and am now trying to figure out how to get it up and running again. I have a bad feeling that it's been somehow wiped out. I open a terminal window, type in the command to start apache, it asks me for my root password, accepts it, but then opens up an empty PICO window. I have no idea of where to begin trouble shooting this. Any help would be appreciated.
ibook Mac OS X (10.3.4)The file that causes the "starting apache" isn't located in the Apache directory -- it's somewhere in /etc .
Updating the OS can occasionally wipe out non-standard installations -- Apache 2 being one such. That's why I remarked that version 1.x is a fine option -- OS X manages it and doesn't kill customizations you make to configurations (as in httpd.conf).
So you can try to get PHP working with Apache 1.x. Or you can try installing Apache 2 again. Make sure you follow instructions specifically for OS X, and make some notes about what you did (put comments in the configuration files, and send yourself an email with links to the instructions, a list of the files you changed, etc).
But sometimes the easiest way to go is to do a clean install of the OS. That puts everything back to where it's supposed to be, and you can take small steps customizing things. You no doubt have a lot of detritus piled up in your system.
Other people definitely think that my way is a bit radical, so before you take my advice, see if someone comes up with some better advice.
Also, let me recommend that you find a quick tutorial for Unix and Terminal. SInce you want to work with some non-standard, non-GUI apps, you will benefit from having some really basic commands (cd, ls, chmod, sudo, tar for example). Here's a good one: <http://www.macdevcenter.com/pub/a/mac/2005/05/20/terminal1.html> -
Can Java do everything that CGI (PHP, Pearl...) can do?
hi,
can you do everything with java, that you can do with cgi, providing that you have a server? I'm completely new to java, thats why I'd like to know this. Can you do for example a chat? Or a multiplayer game or saving and creating files (in an internet programm)?
And how (in general) does it work to write, lets say a chat. I mean the user uses his browser to go to an the URL where my java programm is. So what happens then (just the veryyyy basics to get an idea of how internet programming with java works).
thanxI'm pretty sure it can do anything CGI can. I saw it used for forums and chat rooms, as well as logon-based websites and multiplayer games. I wrote a multiplayer card game with player registration, login, chat, multiple playing rooms, and money amounts saved in about a week and a half with some friends.
Java Server Pages are basically like PHP scripts, essentially outputting HTML for a web browser based on some logic, but they can use all the Java classes and language constructs and connect to databases, communicate with server applications, etc.
For an internet application, you usually need to have a server program that runs on a server machine somewhere and client applications or applets that know where to find it and connect to it. Then you can create a socket connection between the client(s) and the server (if you want multiple clients at the same time you need to use a thread for each one on the server). The socket is basically a link between the two programs that you can input and output to using standard input and output streams (use its getInputStream and getOutputStream methods). You have to decide on some sort of protocol for what the messages you send accross mean, and then write appropriate code on the server and client to handle them.
Maybe you are looking for
-
Report Condition - calculation using "in"
Hi, In the conditions of a report, I would like to define a condition A in ('abc','def',...). Any time that I have tried it in the past it has been a problem (depending on how I wrote the condition, I would either get an error message or it would onl
-
March 2015 TechNet Guru Awards! See who's boss in SSAS! It could be YOU!
The results for March's TechNet Guru competition were posted! http://blogs.technet.com/b/wikininjas/archive/2015/04/17/the-microsoft-technet-guru-awards-march-2015.aspx Below is a summary of the medal winners for December. The last column being a few
-
Wi-fi not showing up in settings
I recieved a new iPhone 4 today, and the set up went fine, but for some reason the wi-fi at my college does not show up at all in the settings, but only in certain areas of campus. I get wi-fi in my room on my macbook and I always have full bars, but
-
SAP Netweaver gateway in solution manager
Hi , We have a solution manager 7.1(netweaver 7.02) and ECC IDES EHP 6 system for which we need to configure Netweaver gateway. We have installed netweaver gateway 2.0 components in solution manager system. Now is it possible to configure gateway on
-
Database links between Oracle 10G and 7.1/7.3 & 8.0 databases
Hi All.. Unfortunately one of our customers is still using very very old unsupported versions of the database - 7.1 and 7.3 and 8.0. They wish to start an upgrade process - moving up to 10G (via staged upgrades) but wish to know whether they can stil